java实现阿拉伯数字转汉字数字
本文实例为大家分享了java实现阿拉伯数字转汉字数字的具体代码,供大家参考,具体内容如下
packagebin; /** *@authorElsa *@paramargs *@param2013-1-21 */ publicclassDoubleTest{ staticString[]units={"","十","百","千","万","十万","百万","千万","亿", "十亿","百亿","千亿","万亿"}; staticchar[]numArray={'零','一','二','三','四','五','六','七','八','九'}; /** *测试 *@paramargs */ publicstaticvoidmain(String[]args){ intnum=234234324; StringnumStr=foematInteger(num); System.out.println("num="+num+",convertresult:"+numStr); doubledecimal=12312; System.out .println("============================================================"); StringdecStr=formatDecimal(decimal); System.out.println("decimal="+decimal+",decStr:"+decStr); } privatestaticStringfoematInteger(intnum){ char[]val=String.valueOf(num).toCharArray(); intlen=val.length; StringBuildersb=newStringBuilder(); for(inti=0;i以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持毛票票。