你可以看看这个Math.round(double a)方法.
System.out.println(Math.round(12.51));//Yields 13
System.out.println(Math.round(12.49));//Yields 12
System.out.println(Math.round(12.50));//Yields 13
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12589 次 |
| 最近记录: |