Find minimum of two numbers using Math.min in Java
Description
The following code shows how to find minimum of two numbers using Math.min.
Example
/*from w w w . j a v a2 s. c o m*/
public class Main {
public static void main(String[] args) {
System.out.println(Math.min(4, 5));
System.out.println(Math.min(4.34f, 2.34f));
System.out.println(Math.min(4.334, 3.342));
System.out.println(Math.min(123123123123123L, 123123123123123L));
}
}
The code above generates the following result.