Here you can find the source of minValue(float[] arr)
Parameter | Description |
---|---|
arr | array of floats |
public static float minValue(float[] arr)
//package com.java2s; public class Main { /**/*from w ww. ja v a 2s. c o m*/ * Returns the smallest value in the array * * @param arr array of floats * @return the value */ public static float minValue(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; } /** * Returns the smallest value in the array * * @param arr array of doubles * @return the value */ public static double minValue(double[] arr) { if (arr.length < 0) return 0; double 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 bytes * @return the value */ public static byte minValue(byte[] arr) { if (arr.length < 0) return 0; byte 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 shorts * @return the value */ public static short minValue(short[] arr) { if (arr.length < 0) return 0; short 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 ints * @return the value */ public static int minValue(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 longs * @return the value */ public static long minValue(long[] arr) { if (arr.length < 0) return 0; long min = arr[0]; for (int i = 1; i < arr.length; i++) { if (arr[i] < min) { min = arr[i]; } } return min; } }