1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
class {
public static boolean isPalindrome(int x) { int origin = x; int result = 0;
if (x < 0) return false;
while (x > 0) { int temp = x % 10; x = x / 10; result = result * 10 + temp; }
if (result == origin) return true; return false; } }
|
近期评论