I want to be able to bubble sort a txt file that contains scores. I have been able to sort alphabets but not integers. I done have an idea on how to go about it. Any solution or input would be highly appreciated. Here is the bubble sort code i have already.
public static void bubbleSort(int array[]) {
boolean swapped = true;
while (swapped) {
swapped = false;
for (int i = 0; i < array.length - 1; i++) {
if (array[i] > array[i + 1]) {
swapped = true;
int temp = array[i];
array[i] = array[i + 1];
array[i + 1] = temp;
}
}
for (int i = 0; i < array.length; i++) {
System.out.print(array[i] + "\t");
}
System.out.println();
}
}