Java Basic Examples

Find Minimum number using min method of Math class in Java

This Java example shows how to find minimum of two numbers using min() method of Java Math class.

How to find minimum of two numbers using Math class?

Use min() static method of Java Math class to find minimumĀ of two numbers.

This method returns minimum of two integer numbers.

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


How to find the minimum of 3 or more numbers?

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


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

Want to learn quickly?
Try one of the many quizzes. I promise you will not be disappointed.