Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Java converts the RMB digital amount input by the console into uppercase.
Java converts the RMB digital amount input by the console into uppercase.
The code is as follows:

/**

* RMB in words.

*

* @param value

* @ Returns a string

*/

Public static string hangeToBig (double precision value)

{

Char[] hunit = {'ten',' hundred',' thousand'}; //Position representation within the segment

Char[] vunit = {'ten thousand',' hundred million'}; //Segment name indicates

Char[] digit = {'zero',' one',' two',' three',' four',' five',' ground',' seven',' eight',' nine'}; //digital representation

Long midVal = (long) (value *100); //Become plastic.

string valStr = string . value of(mid val); //Convert to a string

String head = valStr.substring(0,valstr . length()-2); //Take the integer part

string rail = valstr . substring(valstr . length()-2); //Fractional part

String prefix = ""; //result of integer partial conversion

String suffix = ""; //the result of fractional part conversion

//Processing numbers after decimal point

if (rail.equals("00 "))

{//If the fractional part is 0

Suffix = "whole";

}

other

{

Suffix = number [track. Charat (0)-'0']+ "angle"+number [orbit. Charat (1)-'0']+ "minutes"; //Otherwise, convert corners.

}

//Processing numbers before decimal point

char[]chDig = head . tochararray(); //Convert the integer part into an array of characters.

char zero =“0”; //The symbol "0" indicates that 0 has already appeared.

Byte zeroSerNum = 0;; //Number of consecutive occurrences of 0

for(int I = 0; I & ltchDig.lengthi++)

{//Cycle through each number.

int idx =(chdig . length-I- 1)% 4; //Get the position in the segment

int vidx =(chdig . length-I- 1)/4; //Occupy segment position

if (chDig[i] == '0 ')

{//If the current character is 0

zero sernum++; //Increment 0 times in a row

If (zero == '0')

{//symbol

Zero = number [0];

}

else if(idx = = 0 & amp; & ampvidx & gt0 & amp& ampzeroSerNum & lt4)

{

prefix+= vu nit[vidx- 1];

zero =“0”;

}

Continue;

}

zero sernum = 0; //Zero for 0 consecutive times.

If (zero! = '0')

{//If the flag is not 0, add it, such as tens of billions.

Prefix+= zero;

zero =“0”;

}

Prefix+= number [chdig [i]-'0']; //Convert the digital representation

if(idx & gt; 0)

prefix+= hunit[idx- 1];

if(idx = = 0 & amp; & ampvidx & gt0)

{

prefix+= vu nit[vidx- 1]; //Add the segment name to the end of the segment, for example, ten thousand, one hundred million.

}

}

if(prefix . length()>; 0)

Prefix+=' circle'; //If the integer part exists, there is the word circle.

Return prefix+suffix; //Returns the correct representation.

}