Home >>Java Math Methods >Java Math.ceil() method
The java.lang.Math.ceil() method in Java Math is used to find the smallest integer value which is greater than or equal to the logical integer or argument.
public static double ceil(double x)
x= This parameter is used for a value
This method is used to returns smallest floating point value that is greater than or equal to the argument and is equal to a mathematical integer.
public class MyClass
{
public static void main(String[] args)
{
double a = 13.16;
System.out.println(Math.ceil(a));
}
}
public class Main
{
public static void main(String[] args)
{
double x = -14.13;
System.out.println(Math.ceil(x));
}
}