How to round up a decimal number to a whole number.
3.50 => 4 4.5 => 5 3.4 => 3
3.50 => 4
4.5 => 5
3.4 => 3
How do you do this in Java? Thanks!
With the standard rounding function? Math.round()
Math.round()
There's also Math.floor() and Math.ceil(), depending on what you need.
Math.floor()
Math.ceil()
2.1m questions
2.1m answers
60 comments
57.0k users