Java Array Min Value min(double[] a)

Here you can find the source of min(double[] a)

Description

Returns the min element in a double array

License

Open Source License

Parameter

Parameter Description
a an array of doubles

Return

the min element in this double array

Declaration

public static double min(double[] a) 

Method Source Code

//package com.java2s;

public class Main {
    /** /*  w  w w.  ja va2 s  .  c  o m*/
     * Returns the min element in a double array
     * @param a an array of doubles        
     * @return the min element in this double array
     */
    public static double min(double[] a) {
        double min = a[0]; // assume fst element is the min
        //compare against remaining elements
        for (int i = 1; i < a.length; i++) {
            if (a[i] < min) {
                min = a[i]; // new min
            }
        }
        return min;
    }
}

Related

  1. min(double... args)
  2. min(double... d)
  3. min(double... ds)
  4. min(double... nums)
  5. min(double... value)
  6. min(double[] a, double[] b)
  7. min(double[] arr)
  8. min(double[] arr)
  9. min(double[] array)