1import java.lang.*;
2
3public class Math {
4
5 public static void main(String[] args) {
6
7 // get two double numbers
8 double x = 60984.1;
9 double y = -497.99;
10
11 // call floor and print the result
12 System.out.println("Math.floor(" + x + ")=" + Math.floor(x));
13 System.out.println("Math.floor(" + y + ")=" + Math.floor(y));
14 System.out.println("Math.floor(0)=" + Math.floor(0));
15 }
16}
17Let us compile and run the above program, this will produce the following result −
18
19Math.floor(60984.1)=60984.0
20Math.floor(-497.99)=-498.0
21Math.floor(0)=0.0
1The floor of a floating point number is the largest integer that is <= to the number.