Ceilling and flooring value

ReturnMethodSummary
static doubleceil(double a)Returns the smallest double value that is greater than or equal to a and is equal to an integer.
static doublefloor(double a)Returns the largest double value that is less than or equal to the argument and is equal to an integer.

public class Main {
  public static void main(String[] args) {

    System.out.println(Math.ceil(2.2));
    System.out.println(Math.floor(2.7));
    
  }
}

The output:


3.0
2.0
java2s.com  |  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.