There is a type of numbers that look the same when viewed backwards and forwards, for example: 121, 656, 2332, etc. Such numbers are called palindrome numbers.
#Write a function to determine whether a number is a palindrome number.
public class PalindromeNumber { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); System.out.println("请输入数字:"); String strNum = scan.next(); boolean result = isPalindrome(strNum); System.out.println(result); } public static Boolean isPalindrome(String str){ boolean result=false; for(int i=0; iThe above is the detailed content of How to determine whether a number is a palindrome in java. For more information, please follow other related articles on the PHP Chinese website!