Attempting to find the min/max of a randomly generated array in java. My code is working for finding the maximum, however I'm not sure why when I try running it, the minimum is coming up as 0.0 every time.
public static void main(String[] args) {
double array1[] = new double [10];
int n = array1.length;
double max = array1[0];
double min = array1[1];
System.out.println("Array: ");
for (int i=0; i<n; i++) {
array1[i] = Math.floor((Math.random() * 100) + 1);
System.out.print(array1[i]+ " | " );
if (array1[i] > max) {
max = array1[i];
}
if (min > array1[i]) {
min = array1[i];
}
}
}