直接贴代码
package com.chent.dome.number;
/**
* 阿拉伯数字转大写
* @author Administrator
*
*/
public class Change {
public static final char[] DATE = new char[] {'零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'};
public static final char[] COMPANY = new char[] { '元', '拾', '佰', '仟', '万', '拾', '佰', '仟', '亿' };
public static String convert(int money) {
StringBuffer sbf = new StringBuffer();
int unit = 0;
while (money != 0) {
sbf.insert(0, COMPANY[unit++]);
int number = money % 10;
sbf.insert(0, DATE[number]);
money /= 10;
}
return sbf.toString();
}
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(convert(123456789));
}
}