title: QuickSort with ArrayLists
body: <p>I am trying to implement a <em>quicksort</em> using <code>ArrayLists</code>. However I am not sure how to create one <code>Arraylist&lt;Integer&gt;</code> with all the integers in it. I feel like there is a method I could use to easily do this. Here is my code</p>
  
  <pre><code>public static ArrayList&lt;Integer&gt; quicksort(ArrayList&lt;Integer&gt; arr, int min, int max) {
      int pivot = (min + max)/2;
      if (arr.size() &lt;= 1) {
          return arr;
      }
      else {
          ArrayList&lt;Integer&gt; less = new ArrayList&lt;Integer&gt;();
          ArrayList&lt;Integer&gt; greater = new ArrayList&lt;Integer&gt;();
          for (int i : arr) {
              if ( i &lt; arr.get(pivot)) {
                  less.add(i);
              }
              else {
                  greater.add(i);
              }
          }
          return quicksort(less, min, pivot) + arr.get(pivot) + quicksort(greater, pivot + 1, max);
      }
  }
  </code></pre>