编程没有报错求平均值跟求数组的最大值
一直是
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 5
at Exmaple6_2.sort(Exmaple6_2.java:24)
at Exmaple6_2.main(Exmaple6_2.java:15)
13行以下的删除。用以下示例代码:
int[] scores = {12,3,34,67,100,99};
IntStream intStream = IntStream.of(scores);
IntSummaryStatistics statistics = intStream.summaryStatistics();
System.out.println("the max:" + statistics.getMax());
System.out.println("the average:" + statistics.getAverage());