第1个回答 2009-11-11
最简单的..
public class T {
public static void main(String[] args) {
zhuanhuan(10001101);
}
private static void zhuanhuan(int s) {
String[] c = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" };
String[] d = { "元", "拾", "百", "仟", "万","拾万","百万","千万","亿" };
String ss = s + "";//数字强行转换成字符串
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < ss.length(); i++) {
String k = ss.substring(i, i + 1);
int f = Integer.parseInt(k);
if (f == 0) {
int u = Integer.parseInt(ss.substring(i - 1, i));
if (u != 0) {
buffer.append(c[0]);
}
} else {
buffer.append(c[f]);
buffer.append(d[ss.length() - i - 1]);
}
}
System.out.println(buffer.toString());
}
}