```
class Solution {
public boolean isPalindrome(int x) {
if (x<0){
return false;
}
//turn int x to the StringBuilder
StringBuilder xs = new StringBuilder(String.valueOf(x));
//the index of the number left and right
int indexL = 0;
int indexR = xs.length()-1;
//continue to campare the number if the index of left didn't meet the index of right
while (indexL<indexR){
if (xs.charAt(indexL)!=xs.charAt(indexR)){
return false;
}else{
indexL ++;
indexR --;
}
}
return true;
}
}
```