Math class is part of java.lang package. Math ceil method returns the upper nearest value of double number in fraction. If value is negative, it will return nearest to highest value. ceil function return type is double.
Math ceil example explains how to use Math ceil function in java.
public class JavaMathCeilExample { public static void main(String[] args) { double E1 = Math.ceil(15.156); double E2 = Math.ceil(-15.156); double E3 = Math.ceil(15); System.out.println("Math ceil value :"+E1); System.out.println("Math ceil value :"+E2); System.out.println("Math ceil value :"+E3); } }
Output
Math ceil value :16.0
Math ceil value :-15.0
Math ceil value :15.0
Tags: Math



Link to Us