Java Math.floor() method

The java.lang.Math.floor() is used to find the largest integer value which is less than or equal to the argument and is equal to the mathematical integer of a double value.

Syntax

Parameter

Return

  • If the argument is positive or negative double value, this method will return the Floor value.
  • If the argument is NaN, this method will return same argument.
  • If the argument is Infinity, this method will return Infinity with same sign as the argument.

Example 1

Test it Now

Output:

94.0

Example 2

Test it Now

Output:

-40.0

Example 3

Test it Now

Output:

0.0

Example 4

Test it Now

Output:

-Infinity

Next TopicJava Math




Latest Courses