Round to ceiling
public class Main {
public static void main(String[] args) {
System.out.println(Math.ceil(10));
System.out.println(Math.ceil(9.1));
System.out.println(Math.ceil(5.5));
System.out.println(Math.ceil(-10));
System.out.println(Math.ceil(-4.4));
System.out.println(Math.ceil(0));
}
}
Output:
10.0
10.0
6.0
-10.0
-4.0
0.0
Home
Java Book
Runnable examples
Java Book
Runnable examples
Math:
- Convert between polar and rectangular coordinates
- Random bytes
- Random boolean
- Random integer between lo and hi interval
- Random long type number
- Random numbers between 1 and 100
- Random number between 0 AND 10
- Random integers that range from from 0 to n
- Random string consists of random characters.
- Random array of numbers
- Round float and double numbers
- Round to ceiling
- Round to floor value