http://zhidao.baidu.com/question/120879017
import java.util.Scanner;
public class Huiwen {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String num = in.next();
if (num.matches("\\d+")) {
//方法1 使用数组
char[] nums = num.toCharArray();
String num1="";
for (int i = 0; i < nums.length; i++) {
num1+=nums[i];
}
if(num1.equals(num)){
System.out.println("回文111");
}
// 方法 2 使用StringBuffer reverse方法
StringBuffer sb = new StringBuffer(num);
StringBuffer sb1 = sb.reverse();
System.out.println(sb1);
if(sb1.equals(sb)){
System.out.println("回文");
}
}
}
}