为啥我这个数组输出最大值和总数不对
public class imooc_shuzhu2 {
public static void main(String[] args) {
int[] shuzhu = new int[] { 61, 23, 4, 74, 13, 148, 20 };
int max=shuzhu[0];
int min=shuzhu[0];
double sum=0;
double avg=0;
for(int i=0;i<shuzhu.length;i++){
if(shuzhu[i]>max)
sum=shuzhu[i];
if(shuzhu[i]<min)
min=shuzhu[i];
sum+=shuzhu[i];
}
avg=sum/shuzhu.length;
System.out.println("最小值"+min);
System.out.println("最大值"+max);
System.out.println("平均数"+avg);
}
}