List of utility methods to do Array Max Value
int | findMax(int a, int b, int c, int d) find Max int result = Math.max(a, b); result = Math.max(result, c); result = Math.max(result, d); return result; |
ArrayList | findMax(int[] array) Finds the indexes of the largest values in an integer array. ArrayList<Integer> fields = null; int value = -1; for (int i = 0; i < array.length; i++) { if (array[i] > value) { fields = new ArrayList<>(); fields.add(i); value = array[i]; } else if (array[i] == value) { ... |
int | findMax(int[] v) Find the greatest value from an array of integer int max = Integer.MIN_VALUE; for (int i = 0; i < v.length; ++i) { if (v[i] > max) { max = v[i]; return max; |
int | findMax(int[] workArray, int idx) find Max return findMax2(workArray, idx, workArray[idx]);
|
T | findMax(T[] arr) find Max int maxIndex = 0; for (int i = 1; i < arr.length; i++) if (arr[i].compareTo(arr[maxIndex]) > 0) maxIndex = i; return arr[maxIndex]; |
int | findMax2(int[] workArray, int idx, int max) find Max if (idx <= 0) return max; return findMax2(workArray, idx - 1, Math.max(max, workArray[idx - 1])); |
float | findMaxAbs(float[] array) Finds maximal abs element in array float max = 0; for (int i = 0; i < array.length; i++) { if (Math.abs(array[i]) > max) { max = array[i]; return max; |
String | findMaxCommonPrefix(String path1, String path2) Find maximum common prefix of path1 and path2 int i = 0; int len1 = path1.length(); int len2 = path2.length(); while ((i < len1) && (i < len2)) { if (path1.charAt(i) != path2.charAt(i)) { break; i++; ... |
int | findMaxDiff(byte[] rand, byte[] newRand) find Max Diff int maxDiff = 0; for (int i = 0; i < rand.length; i++) { int diff = Math.abs(rand[i] - newRand[i]); if (diff > maxDiff) maxDiff = diff; return maxDiff; |
int | findMaximumUnitFor(long elapsed, int specifiedMax) find Maximum Unit For int theUnit = specifiedMax; while (elapsed < MILLIS_PER_UNIT[theUnit] && theUnit > SECONDS_UNITS) { theUnit--; return theUnit; |