0 java
显示0.45550我将它舍入为
double dis=0.455504673;
double roundoff=Math.round(dis*100000.0)/100000.0;
System.out.println(roundoff);
Run Code Online (Sandbox Code Playgroud)
我的输出是0.4555,但我需要它作为0.45550 PLZ帮助我知道如何添加偶数为零输出
使用DecimalFormat:
DecimalFormat df = new DecimalFormat("#.00000");
double dis=0.455504673;
System.out.print(df.format(dis));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
50 次 |
| 最近记录: |