Palindrome Number(回文)

class Solution {
public boolean isPalindrome(int x) {
if(x>Integer.MAX_VALUE)
return false;


String string= String.valueOf(x);
char[] chars = string.toCharArray();


for(int i =0,j=chars.length-1;i<=chars.length/2-1;i++,j--)
if(chars[i]!=chars[j])
return false;


return true;
}
}

posted @ 2017-09-03 14:48  戴林甫  阅读(112)  评论(0编辑  收藏  举报