Java Array Min Value min(long[] array)

Here you can find the source of min(long[] array)

Description

min

License

Open Source License

Parameter

Parameter Description
array a long array.

Return

the minimum of the values in this array.

Declaration

public static double min(long[] array) 

Method Source Code

//package com.java2s;
// it under the terms of the GNU General Public License as published by      //

public class Main {
    /**//from w  ww  .jav  a  2 s  . co  m
     * @param array a long array.
     * @return the minimum of the values in this array.
     */
    public static double min(long[] array) {
        return min(array, array.length);
    }

    /**
     * @param array a double array.
     * @return the minimum of the values in this array.
     */
    public static double min(double[] array) {
        return min(array, array.length);
    }

    /**
     * @param array a long array.
     * @param N     the number of values of array which should be considered.
     * @return the minimum of the first N values in this array.
     */
    public static double min(long array[], int N) {

        double min = array[0];

        for (int i = 1; i < N; i++) {
            if (array[i] < min) {
                min = array[i];
            }
        }

        return min;
    }

    /**
     * @param array a double array.
     * @param N     the number of values of array which should be considered.
     * @return the minimum of the first N values in this array.
     */
    public static double min(double array[], int N) {

        double min = array[0];

        for (int i = 1; i < N; i++) {
            if (array[i] < min) {
                min = array[i];
            }
        }

        return min;
    }
}

Related

  1. min(int[] values)
  2. min(int[] vs)
  3. min(int[] x, int length)
  4. min(long first, long... rest)
  5. min(long[] arr)
  6. min(long[] array)
  7. min(long[] array)
  8. min(Number... array)
  9. min(Number[] array)