9. Palindrome Number Posted on 2020-06-13 | Edited on 2021-01-22 | Views: LeetCode 1234567891011121314class Solution { private long reverse(int x){ long i=0; while(x!=0){ i=i*10+x%10; x/=10; } return i; } public boolean isPalindrome(int x) { if(x<0) return false; return reverse(x)>Integer.MAX_VALUE?false:x==(int)reverse(x); }}