List of utility methods to do Array Max Value
int | maxElementIndex(final double[] array, final int endIndex) max Element Index if (array == null || array.length == 0) throw new IllegalArgumentException("Array cannot be null!"); int maxI = 0; for (int i = 1; i < endIndex; i++) { if (array[i] > array[maxI]) maxI = i; return maxI; ... |
int | maxFloorDiv(int c, int... vals) max Floor Div assert (vals.length > 0); assert (vals[0] != 0); int res = Integer.MIN_VALUE; for (int i = 0; i < vals.length; i++) { assert (vals[i] != 0); int tmp = floorDiv(c, vals[i]); if (tmp > res) res = tmp; ... |
double | maxFromDoubleArray(double[] arr) max From Double Array double max = Double.NEGATIVE_INFINITY; for (double d : arr) { if (d > max) max = d; return max; |
int | maxIdx(int[] in) max Idx int out = in[0]; for (int i = 1; i < in.length; i++) { if (in[i] > in[out]) { out = i; return out; |
double | maximum(double[] list) Returns the maximum double in the list of doubles. double max = list[0]; for (int i = 1; i < list.length; ++i) if (list[i] > max) max = list[i]; return max; |
float | maximum(float[] array) Find the maximum element in an array if (array.length <= 0) throw new IllegalArgumentException("The array is empty"); float max = array[0]; for (int i = 1; i < array.length; i++) if (array[i] > max) max = array[i]; return max; |
double | maximumDouble(double... values) maximum Double double ret = values[0]; for (int i = 1; i < values.length; i++) { ret = Math.max(ret, values[i]); return ret; |
int | maximumOf(final int[] array) maximum Of int maximum = array[0]; for (int i = 1; i != array.length; i++) if (maximum < array[i]) maximum = array[i]; return maximum; |
double | maxIn(double[] array) max In double max = -Double.MAX_VALUE; for (double val : array) { max = max < val ? val : max; return max; |
int | maxInArray(int[] src) max In Array int max = src[0]; for (int a : src) { if (a > max) max = a; return max; |