The java.lang.Math.floor() returns the double value that is less than or equal to the argument and is equal to the nearest mathematical integer.
- If the argument is Integer, then the result is Integer.
- If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.
public static double floor(double a)
a : the argument whose floor value is to be determined
Returns : This method returns the double value that is less than or equal
to the argument and is equal to the nearest mathematical integer.
Example :To show working of java.lang.Math.floor() method.
4.0 Infinity 0.0 -0.0 -3.0
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.