我现在开始使用 android 和 java,但遇到了问题。
I have a result x = 206.0548.
And y = 206, both of type double
How do I get the result is always rounded up to 210?
In other cases, assuming x = 203.5231 I wanted to round to 205.
If x = 201 to 205 round off.
If x = 198.25 round off to 200.
...谢谢
最佳答案
数学.ceil(x/5) * 5; 我认为。查找 Math.ceil 方法,因为这是最好的方法。
关于java - 四舍五入 - 几十,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9688271/