public class Tool {
private static final String UNIT = "Hundreds of thousands of thousands of hundred million to pick up the yuan angle points";
private static final String DIGIT = "0 One and three Woolu qi Ba Jiu";
Private static final Double max_value = 9999999999999.99D;
public static String Change (double v) {
if (V < 0 | | V > Max_value) {
Return "argument illegal!";
}
Long L = math.round (v * 100);
if (L = = 0) {
Return "0 yuan whole";
}
String strvalue = l + "";
I used to control the number
int i = 0;
J used to control the unit
Int J = unit.length ()-strvalue.length ();
String rs = "";
Boolean iszero = false;
for (; i < strvalue.length (); i++, J + +) {
char ch = strvalue.charat (i);
if (ch = = ' 0 ') {
Iszero = true;
if (Unit.charat (j) = = ' billion ' | | Unit.charat (j) = = ' million ' | | Unit.charat (j) = = ' Yuan ') {
rs = rs + Unit.charat (j);
Iszero = false;
}
} else {
if (Iszero) {
rs = rs + "0";
Iszero = false;
}
rs = rs + digit.charat (CH-' 0 ') + unit.charat (j);
}
}
if (!rs.endswith ("min")) {
rs = rs + "whole";
}
rs = Rs.replaceall ("Billions", "billion");
Return RS;
}
public static void Main (string[] args) {
System.out.println (Tool.change (12356789.9845));
}
}
Java converts lowercase amounts to uppercase tool classes