To determine whether a number of palindrome examples, palindrome number is the original number and its inverted number is equal, such as: 123321, and then still 123321, that is, palindrome number
Copy Code code as follows:
/**
* To determine whether a number of palindrome number, palindrome number is the original number and the number of inverted after the equal
* such as: 123321, then still 123321, that is, palindrome number
* @author Lvpeiqiang
*/
public class Huiwenshu
{
public boolean ishuiwenshu (int num)
{
int s = 0;
int bnum = num;
int mod;
The following is the method of inverting the numerical value
while (bnum!= 0)
{
MoD = bnum%10; 123%10 = 3
s = s*10 + mod; s = 0*10+3
Bnum = BNUM/10; Bnum = 123/10=12 (int auto conversion)
}
Boolean b = (s = = num);
return b;
}
public static void Main (string[] args)
{
Huiwenshu p = new Huiwenshu ();
Boolean B = P.ishuiwenshu (123321);
System.out.println (b);
}
}