Java ceil () method
ceil () method on a number rounded up, the return value is greater than or equal to the given parameters.
grammar
This method has the following syntax:
double ceil(double d) double ceil(float f)
parameter
- Native data type double or float in.
return value
Return double type, the return value is greater than or equal to the given parameters.
Examples
public class Test{ public static void main(String args[]){ double d = 100.675; float f = -90; System.out.println(Math.ceil(d)); System.out.println(Math.ceil(f)); System.out.println(Math.floor(d)); System.out.println(Math.floor(f)); } }
Compile the above program, the output is:
101.0 -90.0 100.0 -90.0