题解 | #回文数字#
回文数字
http://www.nowcoder.com/practice/35b8166c135448c5a5ba2cff8d430c32
import java.util.*;
public class Solution {
/**
*
* @param x int整型
* @return bool布尔型
*/
public boolean isPalindrome (int x) {
// write code here
if(x < 0) return false;
int result = 0;
int temp = x;
while (temp > 0) {
result = result * 10 + temp % 10;
temp = temp / 10;
}
return x == result;
}
}