```
class Solution(object):
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
if x < 0:
return False
magic = 1
n = x / 10
while n > 0:
n = n / 10
magic = magic * 10
while magic > 0:
digit = x % 10
x = (x - digit * magic) // 10
magic = magic / 100
return x == 0
```