float price=(float) 625.2135;
DecimalFormat decimalFormat=new DecimalFormat("0.00");//这里有几个0就保留几位,如果小数不足位,会以0补足.
String price1=decimalFormat.format(price);//format 返回的是字符串
System.out.println(price1);
版权声明:本文为m0_55051386原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。