0

The method below for bubble sort should work, it displays the unsorted array fine, but for the sorted array it only displays one of the numbers. It seems to have just skipped over the other elements in the array.

Here is a sample output:

How many random even integers would you like to generate? 6

Unsorted:

196

166

68

14

68

176

Sorted:

196

5

```
public static void bubbleSort (int [] array, int length) {
int temp, i, j;
System.out.println("Unsorted: ");
for (i=0; i<array.length; i++)
{
System.out.println(array[i]);
}
for (i=0; i<length-1; i++){
for (j=0; j<length-1; j++)
if (array[j]>array[j+1]){
temp=array[j];
array[j]=array[j+1];
array[j+1]=temp;
}
}
System.out.println("Sorted: ");
for (i=0; i<length-1; i++);
{
System.out.println(array[i]);
System.out.println(i);
}
}
```