09_Palindrome Number

1.Question

2.Solution

public class Solution {
    public boolean isPalindrome(int x) {
        if(x < 0){
            return false;
        }
       int temp = 0;
       int origin = x;
       while( x != 0){
           temp = temp * 10 + x % 10;
           x = x / 10;
           System.out.println(temp);
       }
       return (origin == temp);
    }
}

 

3.Test

posted @ 2016-07-01 17:14  桃源仙居  阅读(69)  评论(0)    收藏  举报