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
(int)(Math.round( 1732 / 10.0) * 10)
Math.round(double)
takes the double
and then rounds up as an nearest integer. So, 1732
will become 173.2
(input parameter) on processing by Math.round(1732 / 10.0)
. So the method rounds it like 173.0
. Then multiplying it with 10 (Math.round( 1732 / 10.0) * 10)
gives the rounded down answer, which is 173.0
will then be casted to int
.