/** * A bubble sort demonstration algorithm */ class BS extends SortAlgorithm { void sort(int a[]) throws Exception { for (int i = a.length; --i>=0;) for (int j = 0; j a[j+1]) { int T = a[j]; a[j] = a[j+1]; a[j+1] = T; pause(i+1,j,j,j+1); } } pause(0,a.length,-1,-1); } }