class ArrayNumber { public static void main(String[] args) { int[] arrayNumber; arrayNumber = new int[10]; System.out.println("以下是随机的10个整数:"); // 填入随机的 10个整数 for (int i = 0; i < arrayNumber.length; i++) { arrayNumber[i] = (int) (100 * Math.random()); System.out.print(arrayNumber[i] + " "); } System.out.println(); int max = arrayNumber[0]; int min = arrayNumber[0]; int sum = 0; for (int i = 0; i < arrayNumber.length; i++) { if (max < arrayNumber[i]) max = arrayNumber[i]; // 求最大值 if (min > arrayNumber[i]) min = arrayNumber[i]; // 求最小值 sum += arrayNumber[i]; } System.out.println("其中 Max=" + max + ",Min=" + min + ",Sum=" + sum + ",Avg=" + sum / 10.0); } }