Here you can find the source of minValue(final int[] arr)
Parameter | Description |
---|---|
arr | array of #t# |
public static int minValue(final int[] arr)
//package com.java2s; //License from project: Apache License public class Main { /**/*from ww w.ja v a 2s. c o m*/ * Returns the smallest value in the array. * * @param arr * array of #t# * @return the value */ public static int minValue(final int[] arr) { if (arr.length < 0) return 0; int min = arr[0]; for (int i = 1; i < arr.length; i++) { if (arr[i] < min) { min = arr[i]; } } return min; } /** * Returns the smallest value in the array. * * @param arr * array of #t# * @return the value */ public static float minValue(final float[] arr) { if (arr.length < 0) return 0; float min = arr[0]; for (int i = 1; i < arr.length; i++) { if (arr[i] < min) { min = arr[i]; } } return min; } }