How to round integer in java

后端 未结 12 835
野趣味
野趣味 2020-12-09 09:19

I want to round the number 1732 to the nearest ten, hundred and thousand. I tried with Math round functions, but it was written only for float and double. How to do this for

12条回答
  •  萌比男神i
    2020-12-09 09:36

    Have you looked at the implementation of Mathutils.round() ? It's all based on BigDecimal and string conversions. Hard to imagine many approaches that are less efficient.

提交回复
热议问题