I'm trying to convert a decimal to a rounded value. I need the easiest way to round the value.
For example, my sample values:
12.63
4.12
22.00
7.96
0.15
Expected result:
13
5
22
8
1
I'm trying to convert a decimal to a rounded value. I need the easiest way to round the value.
For example, my sample values:
12.63
4.12
22.00
7.96
0.15
Expected result:
13
5
22
8
1
It's simple. You can use Java Math class for this. Math.ceil() method rounds off the specified double value and you can then convert it to int by using type casting.
(int)Math.ceil(double value)