Q:

Java round to next 5000

I am looking for some java math.round formula which converts next to nearest 5000 value.
Suppose if the value is 15555, this should convert to 20000.  If the value is 18555, this should also convert to 20000 (since this should give the next 5000 range).
So far I am trying this:
Math.round(value/ 5000.0) * 5000.0)

but if value is 15555, this gives me 15000. I want this to be 20000

A:

You're then looking for Math.ceil(), not Math.round()
Math.ceil(value/ 5000.0) * 5000.0

Compare also nearest integer function with floor and ceiling functions

