Skip to content

Find Minimum number using min method of Math class in Java

Java Math min method example shows how to find a minimum of two numbers using the min method of the Java Math class.

How to find a minimum of two numbers using Math class?

We can use the min static method of the Java Math class to find a minimum of two numbers.

This method returns a minimum of two integer numbers.

The min method has been overloaded for double, float, and long data types so that the same method can be used for all of them.

Output

How to find a minimum of 3 or more numbers?

Themin() method of the Math class accepts only two arguments. So, a minimum of 3 numbers cannot be found directly using the min method. However, we can find a min of 3 numbers like the below given example.

Output

This example is a part of the Java Math class tutorial with examples.

Please let me know your views in the comments section below.

About the author

Leave a Reply

Your email address will not be published.