Java ceil() Method

The method ceil gives the smallest integer that is greater than or equal to the argument.

Here is the detail of parameters

This method has the following variants

This method returns the smallest integer that is greater than or equal to the argument. Returned as a double.

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));

This will produce the following result

Java ceil() Method

Leave a Comment