The floor() method rounds the specified double value downward and returns it. The rounded value will be equal to a mathematical integer. That is, the value 3.8 will be rounded to 3.0 which is equal to integer 3.
Example
Math.floor() Syntax
The syntax of the floor() method is:
Math.floor(double value)
Here, floor() is a static method. Hence, we are accessing the method using the class name, Math.
Math.floor() Parameters
The floor() method takes a single parameter.
- value - number which is to be rounded upward
Math.floor() Return Value
- returns the rounded value that is equal to the mathematical integer
Note: The returned value is the largest value that is smaller than or equal to the specified argument.