Java Math floor() Method

Facebooktwitterredditpinterestlinkedinmailby feather

The floor() method of Math class returns the largest double value that is equal to a mathematical integer and is less than or equal to the argument.

Syntax:

public static double floor(double a)

Parameters:

The parameter ‘a’ represents the value.

Return Value:

The floor () method returns the largest floating-point value that is equal to a mathematical integer and is less than or equal to the argument.

Special cases of the floor() method are as follows:

  • It returns the result same as the argument, if the argument passed is equal to an integer or is a NaN or an infinity or positive zero or negative zero value

Example 1:

 Output:

Example 2:

 Output:

Example 3:

 Output:

Example 4:

 Output:

Example 5:

 Output:

Facebooktwitterredditpinterestlinkedinmailby feather