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

Numbermax(Number... array)
max
Number max = array[0];
for (int j = 1; j < array.length; j++) {
    if (array[j].doubleValue() > max.doubleValue()) {
        max = array[j];
return max;
Numbermax(Number[] array)
Returns the (first occurrence of the) biggest value in the given array.
int index;
index = maxIndex(array);
if (index == -1)
    return null;
else
    return array[index];
Tmax(T first, T... others)
max
T result = first;
for (T value : others) {
    if (value.compareTo(result) > 0) {
        result = value;
return result;
Tmax(T... elems)
max
if (elems.length == 0)
    return null;
T best = elems[0];
for (T t : elems) {
    if (t.compareTo(best) > 0) {
        best = t;
return best;
Tmax(T... values)
max
T result = null;
if (values != null) {
    for (T value : values) {
        if (compare(value, result, false) > 0) {
            result = value;
return result;
Tmax(T[] args)
max
if ((args == null) || (args.length == 0)) {
    return null;
T max = null;
for (int i = 0; i < args.length; i++) {
    T t = args[i];
    if ((max == null) && (t != null)) {
        max = t;
...
bytemax_array(byte[] arr)
maarray
if (arr != null && arr.length > 0) {
    byte max = arr[0];
    for (int i = 0; i < arr.length; i++) {
        if (arr[i] > max) {
            max = arr[i];
    return max;
...
intmax_index(int[] v)
maindex
int a = v[0];
int i = 0;
for (int j = 1; j < v.length; j++) {
    if (v[j] > a) {
        a = v[j];
        i = j;
return i;
intmax_of_ints(int[] data)
Return max of integer array
int max = data[0];
for (int x = 1; x < data.length; x++) {
    if (data[x] > max) {
        max = data[x];
return max;
int[]max_val_subsequence(int[] vals)
Returns the sum and bounds of the maximum subsequence sum within bounds returned in the form {sum, start_index, end_index};
int a = 0, b = 1, max = Integer.MIN_VALUE;
int i = 0, sum = 0;
for (int j = 0; j < vals.length; ++j) {
    sum += vals[j];
    if (max < sum) {
        max = sum;
        a = i;
        b = j + 1;
...