回文数字判断
/** * 回文数字判断 * * @param num * @since 0.0.1 */ public void huiwen(String num){ Integer temp = (num.length())/2 ; System.out.println(temp); boolean flag = true; for (int i = 0; i < num.length(); i++) { if (temp > 0) { if (i >= temp) { break; } } System.out.println("num.charAt(i) = "+num.charAt(i)+";num.charAt(num.length()-1-i)"+num.charAt(num.length()-1-i)); if (num.charAt(i) != num.charAt(num.length()-1-i)) { flag = false; break; } } if (!flag) { System.out.println("不是回文数字"); }else{ System.out.println("是回文数字"); } }