对于我的应用程序,我需要将 float 转换并调整为最接近的整数。
例如
5.430 到 5
5.767 到 6
4.32 到 4
如何在 android 中存档?
我已经使用过 math.ceil() 和 math.nextup() 函数。但它不起作用
最佳答案
使用 Math#round(float a)
会将 float 舍入到最接近的整数。
关于java - 如何将 float 部分调整为下一个整数值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44284415/