public class Test11 {
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(int 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));//这里传的数应该在long类型的范围内啊,但总是报错说超过了范围
}
}
|