Here you can find the source of min(int[] elements)
Parameter | Description |
---|---|
elements | a parameter |
public static int min(int[] elements)
//package com.java2s; /*/* w w w . j av a 2s. c om*/ * This file is part of the Feature Model Synthesis project (FMSynth). * * Copyright (C) 2010 Steven She <shshe@gsd.uwaterloo.ca> * * FMSynth is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. * * FMSynth 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 Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with FMSynth. (See files COPYING and COPYING.LESSER.) If not, see * <http://www.gnu.org/licenses/>. */ public class Main { /** * returns Integer.MAX_VALUE for an empty or null array * * @param elements */ public static int min(int[] elements) { int result = Integer.MAX_VALUE; if (elements != null) for (int i : elements) result = (result <= i ? result : i); return result; } /** * returns Integer.MAX_VALUE for an empty or null array * * @param elements */ public static int min(Iterable<Integer> elements) { int result = Integer.MAX_VALUE; if (elements != null) for (int i : elements) result = (result <= i ? result : i); return result; } }