title: Java recursive insertion sort?
body: <p>So I am trying to make the following code into a recursive method, insertion sort, but for as much as I try I cannot. Can anyone help me?</p>
  
  <pre><code>public static void insertionSort(int[] array){
      for (int i = 1; i &lt; array.length; i++){
          int j = i;
          int B = array[i];
          while ((j &gt; 0) &amp;&amp; (array[j-1] &gt; B)){
              array[j] = array[j-1];
              j--;
          }
          array[j] = B;
      }
  }
  </code></pre>
  
  <p>EDIT:
  I was thinking of something like this, but it doesn't look very recursive to me...</p>
  
  <pre><code>public static void insertionSort(int[] array, int index){
      if(index &lt; array.length){
          int j = index;
          int B = array[index];
          while ((j &gt; 0) &amp;&amp; (array[j-1] &gt; B)){
              array[j] = array[j-1];
              j--;
          }
          array[j] = B;
          insertionSort(array, index + 1);
      }
  }
  </code></pre>