title: java- How would you sort an Integer type array of length 3 where the last index is the middle value?
body: <pre><code>Integer[] array = new Integer[3];
  array[0] = 3;
  </code></pre>
  
  <p>Given a value to insert into the array. </p>
  
  <p>I believe it will be similar to insertion sort utilizing 
  -a while loop and and an 
  -if statement</p>
  
  <ul>
  <li><p>the last index is the middle value of index [0] &amp; [1] ([0]&lt;[2]&lt;[1])</p></li>
  <li><p>The array's length is 3. </p></li>
  <li><p>An integer will by default be in the array[0] index.</p></li>
  </ul>
  
  <p>ex. of properly sorted arrays 
  (1,3,2)
  , (5,10,8)</p>
  
  <h2>step #1)</h2>
  
  <ul>
  <li>If there is only 1 value in the array all that is needed is to compare the valueToInsert and the value in the array. </li>
  </ul>
  
  <p>valueToInsert = 3</p>
  
  <p>(0, null, null)--> (0,3, null)</p>
  
  <h2>step#2)</h2>
  
  <ul>
  <li>If there are 2 values in the array must compare valueToInsert against the two values in the array and place in correct position. </li>
  <li>valueToInsert can 1. only be placed [0] (if less than [0]), 2. placed in[1](if greater than[1], 3. placed in [2](if greater than[0] and less than [1] </li>
  </ul>
  
  <p>valueToInsert = 2</p>
  
  <p>(0,3,null) --> (0,3,2)</p>
  
  <p>How would this be implemented? </p>