Java Array Min Value min(int value1, int value2, int... values)

Here you can find the source of min(int value1, int value2, int... values)

Description

min

License

Open Source License

Declaration

public static int min(int value1, int value2, int... values) 

Method Source Code

//package com.java2s;
/*/*from w ww .ja  v  a  2 s .c o m*/
 * This file is part of the L2J Mobius project.
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

public class Main {
    public static int min(int value1, int value2, int... values) {
        int min = Math.min(value1, value2);
        for (int value : values) {
            if (min > value) {
                min = value;
            }
        }
        return min;
    }

    public static long min(long value1, long value2, long... values) {
        long min = Math.min(value1, value2);
        for (long value : values) {
            if (min > value) {
                min = value;
            }
        }
        return min;
    }

    public static float min(float value1, float value2, float... values) {
        float min = Math.min(value1, value2);
        for (float value : values) {
            if (min > value) {
                min = value;
            }
        }
        return min;
    }

    public static double min(double value1, double value2, double... values) {
        double min = Math.min(value1, value2);
        for (double value : values) {
            if (min > value) {
                min = value;
            }
        }
        return min;
    }
}

Related

  1. min(float[] numbers)
  2. min(float[] v1, float[] v2)
  3. min(float[][] a)
  4. min(float[][] originalValues, float[][] newValues, int[] indexArray, float value)
  5. min(int receiver, int... others)
  6. min(int... _is)
  7. min(int... arr)
  8. min(int... array)
  9. min(int... array)