```
public boolean isPalindrome(int x) {
if (x < 0) return false;
else if (x < 10) return true;
int n = (int) Math.log10(x);
for (int i = n; i > n / 2; i--) {
if (x / (int) Math.pow(10, i) % 10 != x / (int) Math.pow(10, n - i) % 10)
return false;
}
return true;
}
```