title: Using for loops to sort strings
body: <p>I am trying to use two for loops to sort a list of strings alphabetically.</p>
  
  <p>Specifically I am not allowed to use <code>java.util.Collections.sort()</code>.</p>
  
  <pre><code>for(int i = 0; i &lt; str.size(); i++)
  {
      for (int j = i+1; j &lt; str.size(); j++)
      {
          if(str.get(i).compareTo(str.get(j))&lt; 0)
          {
              String temp;
              str.add(temp);
              str.set(str.get(temp),str.get(i));
              str.set(i, str.get(j));
          }
      }
  }
  </code></pre>
  
  <p>Here is what I have so far. The idea is that it could work with any list. The main problem I keep getting is how to add a temporary string in order to retain the data in <code>i</code> and <code>j</code>.</p>