UNB/ CS/ David Bremner/ teaching/ java/ BubbleSort.java
public class BubbleSort{
   Swaps two elements in an array.
   @param  a    the array with the elements
   to swap
   @param  i    the index of one of the elements
   @param  j    the index of the other element
    public static void swap(int[] a,
                            int i, int j){
        int temp = a[i];
        a[i] = a[j];
        a[j] = temp;

       Sorts an array.
       @param a the array to sort
    public static void sort(int[] a){
        boolean finished=false;

            // assume this is the last pass
            for (int i=0; i<a.length-1; i++){
                if (a[i]>a[i+1]){