Java Utililty Methods Array Max Value

List of utility methods to do Array Max Value

Description

The list of methods to do Array Max Value are organized into topic(s).

Method

intfindMaxIndex(final int[] array)
find Max Index
int maxIndex = 0;
for (int i = 1; i < array.length; i++) {
    if (array[maxIndex] < array[i]) {
        maxIndex = i;
return maxIndex;
intfindMaxIndex(int[] a)
Finds the index in 'a' with the largest value.
int max = a[0];
int index = 0;
for (int i = 1; i < a.length; i++) {
    int val = a[i];
    if (val > max) {
        max = val;
        index = i;
return index;
intfindMaxIndex(int[] arr)
find Max Index
return findMaxIndex(arr, 0, arr.length);
voidfindMaxOverlap(final int[] overlapRange, final int[] outputRange, final int[] min, final int[] max)
find Max Overlap
final int minStart = findMinimaGreaterOrEqual(min, overlapRange[0]);
final int correctedMinStart = backtrackForHalfInIntervals(minStart, max, overlapRange[0]);
outputRange[0] = correctedMinStart;
final int maxEnd = findMaximaLessOrEqual(min, overlapRange[1]);
outputRange[1] = maxEnd;
intfindMaxValue(int[] array)
find Max Value
return array[findMaxIndex(array)];
intfindMaxValueIndex(double[] d)
find Max Value Index
int index = 0;
double maxVal = d[0];
for (int i = 0; i < d.length; i++) {
    if (d[i] > maxVal) {
        index = i;
        maxVal = d[i];
return index;
intmax(boolean useInt, int... value)
Calculates the maximum of the given parameters
int max = Integer.MIN_VALUE;
for (int d : value) {
    max = Math.max(max, d);
return max;
bytemax(byte[] arr)
max
byte maxValue = Byte.MIN_VALUE;
for (byte value : arr) {
    if (value > maxValue) {
        maxValue = value;
return maxValue;
bytemax(byte[] array)
max
if (array.length == 0)
    return 0;
byte res = array[0];
for (int i = 1; i < array.length; i++) {
    res = (byte) Math.max(res, array[i]);
return res;
bytemax(byte[] array)

Returns the maximum symbol in an array.

if (array == null)
    throw new IllegalArgumentException("The ArrayEx must not be null");
else if (array.length == 0)
    throw new IllegalArgumentException("ArrayEx cannot be empty.");
byte max = array[0];
for (int i = 1; i < array.length; i++)
    if (array[i] > max)
        max = array[i];
...