class YINHANG2
{
public static void main(String[] args)
{
String[] DanWei= {"圆整","拾","佰","千","万","拾","佰","千","亿","拾","佰","千"};
String[] Num = {"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"};
long num =31210253009l;
int[] Num1 = new int[14];
int j=0;
int t=0;//记位数
do
{
int wei =(int)(num%10);
num /= 10;
Num1[j]= wei;
j++;
t++;
}
while ( num!= 0);//{ 四, 三, 二, 一 }
System.out.println(t);//t=11,有11位
for (int i=1;i<=t ;i++)
{
if (Num1[t-i]==0)
{
if (Num1[t-i]==Num1[t-i-1])
{
}
else
{
System.out.print("零");
}
}
if (Num1[t-i]!=0)
{
System.out.print(Num[Num1[t-i]]);
}
if(t-i+1<=14&&t-i+1>=0)
{
if (i>0&&Num1[t-i]==Num1[t])
{
}
else
{
System.out.print(DanWei[t-i]);//元 1~4
}
}
}
}
}
|