1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| public class test018 { public static void main(String[] args) { int[] array = {1,2,21,41,1235,21,12,52,2351,234,12,234,23,123412,12}; int max = array[0]; for (int i = 1;i < array.length;i++) { if(max < array[i]) { max = array[i]; } } System.out.println("array数组的最大值:" + max);
} }
|