PalindromeNumber.java /** * 9. Palindrome Number * Determine whether an integer is a palindrome. Do this without extra space. * @param x * @return */public static boolean isPalindrome(int x) {if(x0){return false;}if(x10){return true;}int de
/** * 9. Palindrome Number * Determine whether an integer is a palindrome. Do this without extra space. * @param x * @return */ public static boolean isPalindrome(int x) { if(x<0){ return false; } if(x<10){ return true; } int devF = 1; while(x / devF >= 10){ devF *= 10; } while(x>0){ int first = x/devF; int last = x%10; if(first!=last){ return false; } x = (x % devF) / 10; devF = devF/100; } return true; }