public boolean isPalindrome(int x) { String str = Integer.toString(x); String reverse = new StringBuilder(str).reverse().toString(); return str.equals(reverse)?true:false; }