```
if(x < 0) return false;
int l = (int)Math.log10(x);
int tmp = x;
while(l >= 0){
int tmp2 = (int) (x/(Math.pow(10, l)));
//System.out.println(tmp2%10+" last: "+tmp%10);
if(tmp%10 != tmp2%10) {
//System.out.println("inside if "+tmp2%10+" last: "+tmp%10);
return false;
}
tmp/=10;
l--;
}
return true;
```