Java Array Min Value min(int[] arr, int count)

Here you can find the source of min(int[] arr, int count)

Description

min

License

Open Source License

Declaration

public static int min(int[] arr, int count) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Gaggle is Copyright 2010 by Geeksville Industries LLC, a California limited liability corporation. 
 * /* ww w .j  ava  2  s .  c om*/
 * Gaggle is distributed under a dual license.  We've chosen this approach because within Gaggle we've used a number
 * of components that Geeksville Industries LLC might reuse for commercial products.  Gaggle can be distributed under
 * either of the two licenses listed below.
 * 
 * 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. 
 * 
 * Commercial Distribution License
 * If you would like to distribute Gaggle (or portions thereof) under a license other than 
 * the "GNU General Public License, version 2", contact Geeksville Industries.  Geeksville Industries reserves
 * the right to release Gaggle source code under a commercial license of its choice.
 * 
 * GNU Public License, version 2
 * All other distribution of Gaggle must conform to the terms of the GNU Public License, version 2.  The full
 * text of this license is included in the Gaggle source, see assets/manual/gpl-2.0.txt.
 ******************************************************************************/

public class Main {
    public static int min(int[] arr, int count) {
        int r = Integer.MAX_VALUE;

        for (int i = 0; i < count; i++)
            r = Math.min(r, arr[i]);

        return r;
    }
}

Related

  1. min(int... values)
  2. min(int... xs)
  3. min(int[] a)
  4. min(int[] arr)
  5. min(int[] arr)
  6. min(int[] array)
  7. min(int[] array)
  8. min(int[] array)
  9. min(int[] array)