public void selectionSort()
  {
    int maxCompare = a.length - 1;
    int smallestIndex = 0;
    int numSteps = 0;
    
    // loop from 0 to one before last item
    for (int i = 0; i < maxCompare; i++)
    {
      // set smallest index to the one at i
      smallestIndex = i;
      numSteps = 0;
      
      // loop from i+1 to end of the array
      for (int j = i + 1; j < a.length; j++)
      {
        numSteps++;
        if (a[j] < a[smallestIndex])
        {
          smallestIndex = j;
        }
      }
      System.out.println("#steps:"+numSteps);
      
      // swap the one at i with the one at smallest index
      swap(i,smallestIndex);
      this.printArray("after loop body when i = " + i);
    }
  }