The java.lang.Math.floor() method is an inbuilt method that is used to calculate the nearest integer less than (or equal to, if the passed value is itself an integer) the passed value. Floor values are often required in various algorithm-building scenarios dealing with mathematical operations and can be directly seen in different mathematical formulae as well.

Java Math floor()

Java Math.floor(double a) method returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer. If the argument value is already equal to a mathematical integer, then the result is the same as the argument.

Syntax

public static double floor(double x)

#java #java math floor()

Java Math floor() Function Example
1.75 GEEK