Determine whether an integer is a palindrome. Do this without extra space.
public class Solution {
public boolean isPalindrome(int x) {
if(x < 0){
return false;
}
if(x == 0){
return true;
}
if(x > 0){
int finish = x;
//用來存放倒敘相乘的結果
int y = 0;
while(x != 0){
y = y*10 + x%10;
x = x/10;
}
return finish == y ? true:false;
}
return true;
}
}