List of utility methods to do Array Max Value
Number | maxNum(Number iArr[]) max Num if (iArr == null || iArr.length <= 0) { return null; Number rtn = iArr[0]; for (int i = 1; i < iArr.length; i++) { if (rtn.doubleValue() > iArr[i].doubleValue()) { continue; if (rtn.doubleValue() < iArr[i].doubleValue()) { rtn = iArr[i]; continue; return rtn; |
double | maxOfSortedValues(double[] sortedValues) max Of Sorted Values return sortedValues[sortedValues.length - 1];
|
double | maxOverArraySubset(double[] array, Iterable Compute the maximum value over a subset of an array of doubles. double d; d = Double.NEGATIVE_INFINITY; for (int j : subset) { if (array[j] > d) d = array[j]; return d; |
float[] | maxpool(float[] curr, float[] probs) Takes the maximum value at each position if (curr.length != probs.length) { throw new IllegalArgumentException("Float[] need to have the same size"); float[] _ret = new float[curr.length]; for (int i = 0; i < curr.length; i++) { if (curr[i] > probs[i]) { _ret[i] = curr[i]; } else { ... |
int | maxPosition(float[] v) max Position int pos = 0; Float max = Float.MIN_VALUE; for (int i = 0; i < v.length; ++i) { if (v[i] > max) { pos = i; max = v[i]; return pos; |
int | maxPositive(int[] array) max Positive int res = 0; if (max(array) > 0) res = max(array); return res; |
int | maxPrim(final int... numbers) max Prim int max = Integer.MIN_VALUE; for (final int n : numbers) { max = Math.max(max, n); return max; |
int | maxRepeating(int[] input, int k) max Repeating for (int i = 0; i < input.length; i++) { int indexToIncrease = input[i] % k; input[indexToIncrease] = input[indexToIncrease] + k; int max = input[0], result = 0; for (int i = 1; i < input.length; i++) { if (input[i] > max) { max = input[i]; ... |
int | maxRow(Object[]... arr) Returns the first row's index having the maximum length in a 2D array. int maxRowLength = arr[0].length; int maxRow = 0; for (int i = 1; i < arr.length; i++) { if (maxRowLength < arr[i].length) { maxRowLength = arr[i].length; maxRow = i; return maxRow; |
int | maxRowLen(Object[]... arr) max Row Len return arr[maxRow(arr)].length;
|