The floor()
function returns the largest double value that is less than or equal to a specific number.
Figure 1, below, shows the mathematical representation of the floor()
function.
double floor(number num)
This function requires a number as a parameter.
The number can be
int
,float
,double
, orlong
.
floor()
returns the largest double value that is less than or equal to a specific number.
class JAVA {public static void main( String args[] ) {//integerSystem.out.println("Math.floor(2):");System.out.println(Math.floor(2));//positive double valueSystem.out.println("Math.floor(2.56):");System.out.println(Math.floor(2.56));//negative double valueSystem.out.println("Math.floor(-2.36):");System.out.println(Math.floor(-2.36));}}