array maximum java code example
Example 1: java max array
public static double max(double[] arr) {
double result = Double.NEGATIVE_INFINITY;
for (int i = 0; i < arr.length; ++i) {
if (result < arr[i]) result = arr[i];
}
return result;
}
Example 2: maximum arrays size in java
int arr[] = new int[N];// Maximum Value Of N:2,147,483,647 (max int size)