Java Array Min Value min(int... list)

Here you can find the source of min(int... list)

Description

Retrieves the minimum integer in the list.

License

LGPL

Parameter

Parameter Description
list list of integer

Return

the minimum integer

Declaration

public static int min(int... list) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    /**/*from   w  ww .j  av a  2  s .  c  om*/
     * Retrieves the minimum integer in the list.
     * 
     * @param list
     *            list of integer
     * @return the minimum integer
     */
    public static int min(int... list) {
        int min = list[0];
        for (int i : list) {
            if (i < min) {
                min = i;
            }
        }
        return min;
    }

    /**
     * Retrieves the minimum long integer in the list
     * 
     * @param list
     *            list of long integer
     * @return the minimum long integer
     */
    public static long min(long... list) {
        long min = list[0];
        for (long i : list) {
            if (i < min) {
                min = i;
            }
        }
        return min;
    }

    /**
     * Retrieves the minimum double in the list
     * 
     * @param list
     *            list of double
     * @return the minimum double
     */
    public static double min(double... list) {
        double min = list[0];
        for (double i : list) {
            if (i < min) {
                min = i;
            }
        }
        return min;
    }
}

Related

  1. min(int value1, int value2, int... values)
  2. min(int... _is)
  3. min(int... arr)
  4. min(int... array)
  5. min(int... array)
  6. min(int... numbers)
  7. min(int... vals)
  8. min(int... values)
  9. min(int... xs)