编辑代码

public class Main {
	public static void main(String[] args) {
     int arr[]  = new int[]{2,6,24,3,18,60,20,44};
        int max = arr[0];//最大值
        int min = arr[0];//最小值
        int sum = arr[0];/总数
        for(int i=1; i<arr.length; i++){
            sum = sum+arr[i];
            if(max < arr[i]){
                max = arr[i];
            }
            if(min > arr[i]){
                min = arr[i];
            }
        }
        System.out.println("最大值:"+max +",最小值:"+min
                +"总数:"+sum +"平均值:"+(double)sum/arr.length);
	}
}