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

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

Description

min

License

Open Source License

Declaration

public static int min(int... xs) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static int min(int... xs) {
        if (xs.length == 0)
            throw new RuntimeException("ArrayHelper.min cannot be used on an empty array.");
        int v = Integer.MAX_VALUE;
        for (int x : xs)
            if (x < v)
                v = x;//from   w w w  .j a  v  a  2s . co m
        return v;
    }

    public static double min(double... xs) {
        if (xs.length == 0)
            throw new RuntimeException("ArrayHelper.min cannot be used on an empty array.");
        double v = Double.MAX_VALUE;
        for (double x : xs)
            if (x < v)
                v = x;
        return v;
    }
}

Related

  1. min(int... array)
  2. min(int... list)
  3. min(int... numbers)
  4. min(int... vals)
  5. min(int... values)
  6. min(int[] a)
  7. min(int[] arr)
  8. min(int[] arr)
  9. min(int[] arr, int count)