Java digital amount conversion Chinese amount, java Chinese
Public static String digitUppercase (double n ){
String fraction [] = {"", "points "};
String digit [] = {"zero", "one", "two", "three", "Si", "Wu", "Lu", "Lu ", "identifier", "identifier "};
String unit [] [] = {"Yuan", "Ten Thousand", "hundred million "},
{"", "Pick", "success", "success "}};
String head = n <0? "Negative ":"";
N = Math. abs (n );
String s = "";
For (int I = 0; I <fraction. length; I ++ ){
S + = (digit [(int) (Math. floor (n * 10 * Math. pow (10, I) % 10)] + fraction [I]). replaceAll ("(0 .) + ","");
}
If (s. length () <1 ){
S = "whole ";
}
Int integerPart = (int) Math. floor (n );
For (int I = 0; I <unit [0]. length & integerPart> 0; I ++ ){
String p = "";
For (int j = 0; j <unit [1]. length & n> 0; j ++ ){
P = digit [integerPart % 10] + unit [1] [j] + p;
IntegerPart = integerPart/10;
}
S = p. replaceAll ("(0 .) * zero $ ",""). replaceAll ("^ $", "0") + unit [0] [I] + s;
}
Return head + s. replaceAll ("(0 .) * zero RMB "," RMB "). replaceFirst ("(0 .) + ",""). replaceAll ("(0 .) + "," zero "). replaceAll ("^ whole $", "zero yuan whole ");
}