I'm a beginner at java and I have a hopefully simple question. I can get the numbers in order, but only a certain amount of numbers are added to the array. When there is a number less than the smallest number, it replaces that smallest number (the previous smallest gets removed from array). What can I do so that all of the array spots can be filled in?
public class apples {
public static void main(String[] args) {
System.out.print("How many numbers: ");
int num=IO.readInt();
double array[]=new double[num];
double temp;
boolean fixed=false;
while (fixed==false){
fixed=true;
for(int j=0; j<num;j++){
double x = IO.readDouble();
array[j] = x;
for (int i = 0; i < ( num - 1 ); i++) {
for (j = 0; j < num - i - 1; j++) {
if (array[j] > array[j+1]) {
temp = array[j];
array[j] = array[j+1];
array[j+1] = temp;
fixed=false;
}
}
}
System.out.println("Sorted list of integers:");
for (int i = 0; i < num; i++)
System.out.println(array[i]);
}
}
}
}