public static int maxNum(int[] array){ if(array == null) return -1; if (array.length == 0) return -1; int max = array[0]; for (int i = 1; iPrint result:
The above is the detailed content of How to find the largest element in an array in java. For more information, please follow other related articles on the PHP Chinese website!