Determine whether an integer is a palindrome. Do this without extra space.
负数不算回文串;
将此整数求逆可能会发生溢出,当不属于回文串的情况下;
只用转换一般进行比较即可;
public boolean isPalindrome(int x) {
if(x<0||(x%10==0&&x!=0))
return false;
boolean result=false;
int x1=0;
while(x1<x){
x1=x1*10+x%10;
x/=10;
}
if(x==x1||x1/10==x)
result=true;
return result;
}