```
public boolean isPalindrome(int x) {
if(x < 0) return false;
int factor = 1;
while(x / factor >= 10){
factor *= 10;
}
while(x != 0){
if((x / factor) != (x % 10)){
return false;
}
x = (x % factor) / 10;
factor /= 100;
}
return true;
}
```