title: Bubble Sort method swapping
body: <p>My assignment requires me to code several methods that will compare an array of first names from a .txt file.</p>
  
  <p>I'm currently stuck on a BubbleSort method. Trying to get it to run.</p>
  
  <p>This is my code for the BubbleSort:</p>
  
  <pre><code> public static int bubbleSort(String[] array) {
      boolean swapped = false;
      int compNumber = 0;
      int length = length.array;
      while (swapped = false) {
        for (int i = 0; i &lt; length.array-1; i++) {
          if (array[i-1] &gt; array[i]) {
            String temp = 
            array[i-1] = array[i];
            swapped = true;
          }
        }
      }
      return compNumber;
    }
  </code></pre>
  
  <p>I don't believe I'm swapping correctly because I'm not sure how to use the temp variable (hence it being blank). </p>
  
  <p>Could someone take a look at this and point me in the right direction? </p>
  
  <p>Thanks very much in advance!</p>