public class Test10 {
public static String[] cn={"仟","佰","拾","亿","仟","佰","拾","万","仟","佰","拾","圆整"};
public static String[] number={"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"};
public static String getString(long n)
{
String money=""+n;
if(money.length()>cn.length)
return "钱太多";
String str="";
for(long i=0;i<money.length();i++)
str+=number[Integer.parseInt(""+money.charAt(i))]+cn[cn.length-money.length()+i];
return str;
}
public static void main(String[] args) {
System.out.print(getString(101000001010));
}
}
帮忙优化下吧 101000001010 把它转了。 |
|