为什么最小值总是0?
package green;
public class Array {
public static void main(String[] args) {
int[] a = new int[10];
int max = a[0];
int min = a[0];
int sum = 0;
for (int i = 0; i < a.length; i++) {
a[i] = (int) (Math.random() * 100);
System.out.println(a[i]);
if (max < a[i]) {
max = a[i];
}if(min > a[i]) {
min = a[i];
}
sum += a[i];
}
System.out.println("最大值:" + max + "最小值:" + min + "总和:" + sum + "平均值:" + sum / 10.0);
}
}