本回答被网友采纳
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Hanzi {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("请输入一个三位数");
Scanner sn=new Scanner(System.in);
int code=sn.nextInt();
Map<Integer,String> map=new HashMap<>();
map.put(1, "壹");
map.put(2, "贰");
map.put(3, "叁");
map.put(4, "肆");
map.put(5, "伍");
map.put(6, "陆");
map.put(7, "柒");
map.put(8, "捌");
map.put(9, "玖");
if(code>100&&code<1000) {
int c=code/100;
int d=code%100;
int e=d/10;
int f=d%10;
if(e==0) {
System.out.println(map.get(c)+"佰零"+map.get(f));
}else {
System.out.println(map.get(c)+"佰"+map.get(e)+"十"+map.get(f));
}
}
}
}