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.


About the author



rahimv has over 15 years of experience in designing and developing Java applications. His areas of expertise are J2EE and eCommerce. If you like the website, follow him on Facebook, Twitter or Google Plus.

Add Comment

Your email address will not be published. Required fields are marked *