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