Java Utililty Methods Array Min Value

List of utility methods to do Array Min Value

Description

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

Method

int[]minMax(int[] values)
Calculates the min and max values of an array
int min = values[0];
int max = values[0];
int len = values.length;
for (int i = 1; i < len; i++) {
    int val = values[i];
    if (val > max) {
        max = val;
    if (val < min) {
        min = val;
return new int[] { min, max };
doubleminmax(String args[], boolean minimum)
minmax
double min = Double.MAX_VALUE;
double max = Double.MIN_VALUE;
for (int i = 1; i < args.length; i++) {
    double temp = Double.parseDouble(args[i]);
    if (min > temp) {
        min = temp;
    if (max < temp) {
...
int[]minMaxAvg(int[] arr)
min Max Avg
int minIndex = 0;
int minValue = arr[0];
int maxIndex = 0;
int maxValue = arr[0];
int total = arr[0];
for (int i = 1; i < arr.length; i++) {
    if (minValue > arr[i]) {
        minIndex = i;
...
doubleminMaxOverArraySubset(double[] array, Iterable subset, boolean min)
Compute the minimum or maximum value over a subset of an array of doubles.
if (min)
    return minOverArraySubset(array, subset);
else
    return maxOverArraySubset(array, subset);
intminNonNeg(int... vals)
min Non Neg
int min = -1;
for (int val : vals) {
    if (val >= 0) {
        if (min >= 0)
            min = Math.min(min, val);
        else
            min = val;
return min;
NumberminNum(Number iArr[])
min 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[]minOf(double[] da, double val)
min Of
double[] out = new double[da.length];
for (int i = 0; i < out.length; i++) {
    out[i] = Math.min(da[i], val);
return out;
intminOfArr(int[] arrInput)
minOfArr will return the minimum value in array.
int min = 0;
for (int idx = 1; idx < arrInput.length; idx++) {
    if (arrInput[idx] != 99999) {
        min = arrInput[idx] < arrInput[min] ? idx : min;
return min;
floatminOfArray(float[] array)
Returns the minimal value in a given array
float min = Float.MAX_VALUE;
for (int i = 0; i < array.length; i++) {
    if (array[i] < min) {
        min = array[i];
return min;
intminOfCol(int[][] matrixTable, int colBound)
minOfCol will return the minimum value of table based on specific column.
int min = matrixTable[0][colBound];
for (int idx = 1; idx < matrixTable.length; idx++) {
    if (matrixTable[idx][colBound] != 99999) {
        min = matrixTable[idx][colBound] < min ? matrixTable[idx][colBound] : min;
return min;