数字转成汉字表示(如222,1221 ,注意特殊情况:101,1001,10100等)
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
System.out.print("请输入一个整数:");
Scanner input = new Scanner(System.in);
int number = input.nextInt();
String s = String.valueOf(number);
String[] ss = new String[s.length()];
for (int i = 0; i < s.length(); i++) {
ss[i] = s.substring(i, i + 1);
int n = Integer.parseInt(ss[i]);
switch (n) {
case 0:
System.out.print("零");
break;
case 1:
System.out.print("壹");
break;
case 2:
System.out.print("贰");
break;
}
}
}
}