public boolean isPalindrome(int x) {
if(x<0) return false;
int temp = x;
int num = 0;
while (temp != 0) {
num = num * 10 + temp % 10;
temp = temp / 10;
}
if (num == x) {
return true;
}
return false;
}
Operate the num like Stack operation


@otoom.doaagmail.com it just reverse the number,and return true when it equal to the original number.
Exp:number 121.
first,we can get num = 1 by num*10 + temp %10,temp = 12 by temp =temp/10.
and on the second interation,we can get num = 12 by num%10 + temp%10,and the above iteration's result as the follow result,we can reverse the num 121 to 121,which is equal the original number and it's a true Palindrome