Here you can find the source of range(long array[])
Parameter | Description |
---|---|
array | a long array. |
public static double range(long array[])
//package com.java2s; // it under the terms of the GNU General Public License as published by // public class Main { /**/*from w w w .ja v a2 s .c o m*/ * @param array a long array. * @return the range of the values in this array. */ public static double range(long array[]) { return (max(array, array.length) - min(array, array.length)); } /** * @param array a double array. * @return the range of the values in this array. */ public static double range(double array[]) { return (max(array, array.length) - min(array, array.length)); } /** * @param array a long array. * @param N the number of values of array which should be considered. * @return the range of the first N values in this array. */ public static double range(long array[], int N) { return (max(array, N) - min(array, N)); } /** * @param array a double array. * @param N the number of values of array which should be considered. * @return the range of the first N values in this array. */ public static double range(double array[], int N) { return (max(array, N) - min(array, N)); } /** * @param array a long array. * @return the maximum of the values in this array. */ public static double max(long[] array) { return max(array, array.length); } /** * @param array a double array. * @return the maximum of the values in this array. */ public static double max(double[] array) { return max(array, array.length); } /** * @param array a long array. * @param N the number of values of array which should be considered. * @return the maximum of the first N values in this array. */ public static double max(long array[], int N) { double max = array[0]; for (int i = 0; i < N; i++) { if (array[i] > max) { max = array[i]; } } return max; } /** * @param array a double array. * @param N the number of values of array which should be considered. * @return the maximum of the first N values in this array. */ public static double max(double array[], int N) { double max = array[0]; for (int i = 0; i < N; i++) { if (array[i] > max) { max = array[i]; } } return max; } /** * @param array a long array. * @return the minimum of the values in this array. */ public static double min(long[] array) { return min(array, array.length); } /** * @param array a double array. * @return the minimum of the values in this array. */ public static double min(double[] array) { return min(array, array.length); } /** * @param array a long array. * @param N the number of values of array which should be considered. * @return the minimum of the first N values in this array. */ public static double min(long array[], int N) { double min = array[0]; for (int i = 1; i < N; i++) { if (array[i] < min) { min = array[i]; } } return min; } /** * @param array a double array. * @param N the number of values of array which should be considered. * @return the minimum of the first N values in this array. */ public static double min(double array[], int N) { double min = array[0]; for (int i = 1; i < N; i++) { if (array[i] < min) { min = array[i]; } } return min; } }