BeginnersBook

  • Home
  • Java
    • Java OOPs
    • Java Collections
    • Java Examples
  • C
    • C Examples
  • C++
    • C++ Examples
  • DBMS
  • Computer Network
  • Python
    • Python Examples
  • More…
    • jQuery
    • Kotlin
    • WordPress
    • SEO
    • JSON
    • JSP
    • JSTL
    • Servlet
    • MongoDB
    • XML
    • Perl

Java Integer min() Method

Last Updated: October 25, 2022 by Chaitanya Singh | Filed Under: java

The min() method of Integer class, returns smaller of two int numbers passed as arguments to this method. It works similar to Math.min() method.

Hierarchy:

java.lang Package
    -> Integer Class
        -> min() Method 

Syntax of min() method

public static int min(int a, int b)

min() Parameters

  • a – First operand.
  • b – Second operand.

min() Return Value

  • Returns smaller number between the two int arguments a and b.

Supported versions: Java 1.8 and onwards.

Example 1

public class JavaExample {
  public static void main(String[] args) {
    int a = 15, b = 6;
    System.out.println("Given numbers are: "+a+", "+b);
    System.out.println("Smaller of given numbers: "+Integer.min(a,b));
  }
}

Output: