这个方法试试看:
public class Demo {
/*
* 从键盘录入阿拉伯数字 打印出对照的汉语数字
*/
public static void main(String[] args) throws Exception {
show();
}
public static void show() throws Exception {
// 获取键盘录入:
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] str = new String[] { "零", "一", "二", "三", "四", "五", "六", "七",
"八", "九" };
// 获取临时存储器
StringBuilder sb = new StringBuilder();
Integer ip = Integer.parseInt(br.readLine());
sb.append(ip);
for (int x = 0; x < sb.length(); x++) {
Integer i = Integer.parseInt(sb.substring(x, x + 1));
System.out.print(str[i]);
}
}
}
|