Determine whether an integer is a palindrome. Do this without extra space.
1 public class Solution { 2 public boolean isPalindrome(int x) { 3 if(x<0) return false; 4 int div = 1; 5 while(x/div>=10){ 6 div *=10; 7 } 8 while(x>0){ 9 if(x/div!=x%10) return false; 10 x = x%div/10; 11 div /=100; 12 } 13 return true; 14 } 15 }