java - value to the next thousand instead of nearest thousand -
But I have no idea how to do this. I tried Math.round
, but it is for the goal. Please guide me, any help would be appreciated.
Expected output that I am looking for:
Example 1) If this location is less than 999 then it should be directly 1000
How can I code the mathematical formula for this?
You can use Math.ceil
for this.
// An instant code example: int val = 1400; Val = monastery CEL (VAL / 1000) * 1000;