Palindrome Number

Problem

Determine whether an integer is a palindrome. Do this without extra space.

click to show spoilers.

Code

public boolean isPalindrome(int x) {
        if (x<0){
            return false;
        }
        long result = 0;
        int y = x;
        while (y!=0){
            int temp = y%10;
            result = result*10+temp;
            y/=10;
        }
        if (result==x){
            return true;
        }else{
            return false;
        }
    }
原文地址:https://www.cnblogs.com/bingo2-here/p/7168518.html