Tutorials Point


  Java Basics
  Java Object Oriented
  Java Advanced
  Java Useful References
  Java Useful Resources
  Selected Reading

© 2011 TutorialsPoint.COM


  Home     References     Discussion Forums     About TP  

Java - floor() Method


previous next AddThis Social Bookmark Button


Description:

The method floor gives the largest integer that is less than or equal to the argument.

Syntax:

This method has following variants:

double floor(double d)

double floor(float f)

Parameters:

Here is the detail of parameters:

  • A double or float primitive data type

Return Value :

  • Returns the largest integer that is less than or equal to the argument. Returned as a double.

Example:

public class Test{ 
   public static void main(String args[]){
      double d = -100.675;
      float f = -90;    
	 
      System.out.println(Math.floor(d));
      System.out.println(Math.floor(f)); 

      System.out.println(Math.ceil(d));
      System.out.println(Math.ceil(f));
   }
}

This produces following result:

-101.0
-90.0
-100.0
-90.0


previous next Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names