Determine whether an integer is a palindrome. Do this without extra space.
public class Solution {
public boolean isPalindrome(int x) {
if(x < 0) return false;
if(x / 10 == 0) return true;
int reverse = 0;
int num = x;
while(x != 0){
reverse = reverse * 10 + x % 10;
x /= 10;
}
return reverse == num;
}
}