Answers for "find maximum value in array java method"

3

how to get the max value of an array java

public static double arrayMax(double[] arr) {
    double max = Double.NEGATIVE_INFINITY;

    for(double cur: arr)
        max = Math.max(max, cur);

    return max;
}
Posted by: Guest on May-10-2020
0

find min in array java

private static int findMin(int[] array) {
		int min = array[0];
		for(int i=1;i<array.length;i++) {
			if(min > array[i]) {
				min = array[i];
			}
		}
		return min;
	}
Posted by: Guest on May-10-2020

Code answers related to "find maximum value in array java method"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language