java division retains the specified number of decimal places

     float . price = ( float ) 625.2135 ; 
        DecimalFormat DecimalFormat = new new DecimalFormat ( " .00 " ); // . Here are a few on the reservation a few 0, if the decimal place is insufficient, will make up 0 
        String price1 = decimalFormat.format (price ); // the format string returns 
        the System. OUT .println (price1);

The results are as follows

 

Guess you like

Origin www.cnblogs.com/837634902why/p/10972840.html
Recommended