Get the index position of maximum value the given array
@param array an array
@return	index of the max value in array
437997
public int getMaxValueIndex(double[] array) {

        int index = 0;
        double max = Integer.MIN_VALUE;

        for (int i = 0; i < array.length; i++) {
            if (array[i] > max) {
                max = array[i];
                index = i;
            }
        }

        return index;
    }
1038740
public static byte searchMax(byte[] byteArray) {
        if(byteArray.length == 0) {
            throw new IllegalArgumentException("The array you provided does not have any elements");
        }

        byte max = byteArray[0];

        for(int i = 1; i < byteArray.length; i++) {
            if(byteArray[i] > max) {
                max = byteArray[i];
            }
        }

        return max;
    }
872903
public long[] toPrimitiveArray(long[] array) {
	for (int i = 0, j = 0; i < array.length; ++i) {
	    int index = -1;
	    if (j < indices.length && (index = indices[j]) == i) {
		array[i] = values[j];
		j++;
	    }
	    else
		array[i] = 0;
	}

	return array;
    }
143643
private int rightmostIndexBelowMax() {
		for (int i = r-1; i>=0; i--)
			if (index[i] < n - r + i) return i;
		return -1;
	}
847268
public int getMaxIdx() {
        int max = Integer.MIN_VALUE;
        for (int i=0; i<this.top; i++) {
            if (idx[i] > max) {
                max = idx[i];
            }
        }
        return max;
    }
1332953
public static int min(IntArrayND array)
    {
        return array.stream().parallel().reduce(
            Integer.MAX_VALUE, Math::min);
    }
1356992
public static long searchMax(long[] longArray) {
        if(longArray.length == 0) {
            throw new IllegalArgumentException("The array you provided does not have any elements");
        }

        long max = longArray[0];

        for(int i = 1; i < longArray.length; i++) {
            if(longArray[i] > max) {
                max = longArray[i];
            }
        }

        return max;
    }
940860
function arrayMax(data) {
	var i = data.length,
		max = data[0];

	while (i--) {
		if (data[i] > max) {
			max = data[i];
		}
	}
	return max;
}
766461
public static double min(Array array) throws PageException {
	if (array.getDimension() > 1) throw new ExpressionException("can only get max value from 1 dimensional arrays");
	if (array.size() == 0) return 0;

	double rtn = _toDoubleValue(array, 1);
	int len = array.size();
	try {
	    for (int i = 2; i <= len; i++) {
		double v = _toDoubleValue(array, i);
		if (rtn > v) rtn = v;

	    }
	}
	catch (PageException e) {
	    throw new ExpressionException("exception while execute array operation: " + e.getMessage());
	}
	return rtn;
    }
686092
public static <T extends Number> int[] asArray(final T... array) {
        int[] b = new int[array.length];
        for (int i = 0; i < b.length; i++) {
            b[i] = array[i].intValue();
        }
        return b;
    }
29589
@SafeVarargs
    public static <V> V getLast(V... array) {
        return JMArrays.isNullOrEmpty(array) ? null : array[array.length - 1];
    }
579718
public T max() {
        if (sum == 0)
            return null;
        int maxCount = -1;
        int maxIndex = -1;
        for (TIntIntIterator it = indexToCount.iterator(); it.hasNext(); ) {
            it.advance();
            if (it.value() > maxCount) {
                maxIndex = it.key();
                maxCount = it.value();
            }
        }
        return objectIndices.lookup(maxIndex);
    }
1349927
public static double searchMax(int[] intArray) {
        if(intArray.length == 0) {
            throw new IllegalArgumentException("The array you provided does not have any elements");
        }

        int max = intArray[0];

        for(int i = 1; i < intArray.length; i++) {
            if(intArray[i] > max) {
                max = intArray[i];
            }
        }

        return max;
    }
1372202
public static int whichMax(int[] x) {
        int m = x[0];
        int which = 0;

        for (int i = 1; i < x.length; i++) {
            if (x[i] > m) {
                m = x[i];
                which = i;
            }
        }

        return which;
    }
836684
function max(x) {
        var value;
        for (var i = 0; i < x.length; i++) {
            // On the first iteration of this loop, max is
            // undefined and is thus made the maximum element in the array
            if (x[i] > value || value === undefined) value = x[i];
        }
        return value;
    }
920389
public static int getMaxIndex(DoubleMatrix1D v){
	  	int maxIndex = -1;
	  	double maxValue = -Double.MAX_VALUE;
	  	for(int i=0; i<v.size(); i++){
	  		if(v.getQuick(i)>maxValue){
	  			maxIndex = i;
	  			maxValue = v.getQuick(i); 
	  		}
	  	}
	  	return maxIndex; 
	  }
86161
public static INDArray max(INDArray first, INDArray second) {
        return max(first, second, true);
    }