I have been playing around with rounding numbers for quite some time trying to figure this one out. I have tried a few things such as BigDecimal, Math.round, and NumberFormat. But have not gotten any of them correct. I am looking for a way that I could do something as follows:
- Code: Select all
1.0 = 1
1.1 = 2
1.5 = 2
2.0 = 2
2.2 = 3
In words, I would like to round the number up if it is bigger than the previous whole number, rather than up at "x.5"
What would be the easiest method of completing this task?