package com.dengpf.HuiWen;
/**
* Created by kobe73er on 16/12/17.
*/
public class Solution {
public boolean isPalindrome(int x) {
String result = String.valueOf(x);
int start = 0;
int end = result.length() - 1;
while (start < end) {
if (result.charAt(start)!=result.charAt(end)){
return false;
}
start++;
end--;
}
return true;
}
public static void main(String args[]){
Solution solution = new Solution();
System.out.println(solution.isPalindrome(11));
}
}
判断是否是回文数字
最新推荐文章于 2021-09-24 20:04:30 发布