int[] arr = {61, 23, 4, 74, 13, 148, 20};
double sum = 0;
int i = 6;
for (; i < arr.length && i-1 >= 0; i--) {
if (arr[i] > arr[i - 1]) {
arr[i - 1] = arr[i];
}
}
System.out.println("数组中最大值为:" + arr[i]);
System.out.println("*****************************************");
int[] arr1 = {61, 23, 4, 74, 13, 148, 20};
int j = 6;
for (; j < arr1.length && j-1 >= 0; j--) {
if (arr1[j] < arr1[j - 1]) {
arr1[j - 1] = arr1[j];
}
}
System.out.println("数组中最小值为:" + arr1[j]);
System.out.println("*****************************************");
int[] arr2 = {61, 23, 4, 74, 13, 148, 20};
for(int k=0;k<arr2.length;k++){
sum=sum+arr2[k];
}
System.out.println("数组中平均值为:" + sum/arr.length);