题目要求:判断一个数是否为回文数

分析,主要是把数反转过来然后跟原数比较

java:class Solution {
    public boolean isPalindrome(int x) {
        int s=0;
        int y=x;
        if(x<0)
            return false;
        else{
            while(y!=0){//while里是数的反转过程
                s=s*10+y%10;
                y=y/10;
            }
        }
        boolean b=(s==x);
            return b;
        
        
    }
}