The min () method of Math class returns the smaller of two arguments. The arguments can be of double, float, int or long data type.


  1. public static double min (double a, double b)
  2. public static float min (float a, float b)
  3. public static int min (int a, int b)
  4. public static long min (long a, long b)


The parameters ‘a’ and ‘b’ represent the two values.

Return Value:

The min() method returns the smaller of a and b.

  • It returns the result of same value, if the arguments have same value
  • It returns NaN, if either value is NaN.
  • It returns negative zero, if one argument is positive zero and the other is negative zero.

Example 1:


Example 2:


Example 3:


Example 4:


Pin It on Pinterest

Share This