Lower Integer using Math.floor

Compiled By Unknown - No Comments
Likewise the Math.floor method always returns a lower integer. So 1.9 is lowered to 1, as is 1.1. For negative numbers, floor() still lowers.
Java program that uses Math.floor

import java.lang.Math;

public class Program {
    public static void main(String[] args) {

 // These are all reduced, even the negative number.
 double floor1 = Math.floor(1.9);
 double floor2 = Math.floor(1.1);
 double floor3 = Math.floor(-1.3);

 System.out.println(floor1);
 System.out.println(floor2);
 System.out.println(floor3);
    }
}

Output

1.0
1.0
-2.0

2. minimum value using java Math Class

Syntax:-

Math.min(variable1,variable2)

Here variable can be double,float,int and long datatype

min method is used to find minimum value between variable1 and variable2.

Math.min(2,8) = 2

Tags:

No Comment to " Lower Integer using Math.floor "