title: Need help fixing my selection sorting
body: <p>My method is supposed to return the position of the largest element in the unsorted portion of the array, the second parameter to the method specifies the largest index that is where the unsorted portion of the array ends. My testMaxPositionMiddle passes but my testMaxPositionFirst fails i don't understand why.</p>
  
  <pre><code>public Object maxPosition(int[] array, int x)
  {
  
  for( int i = 0; i &lt; array.length - 1; i++)
  {
      int maxPosition = i;
      for( int j = 0; j &lt; array.length; j++)
      {
          if(array[j] &gt; array[maxPosition])
          {
              maxPosition = j;
              return maxPosition;
          }
      }
  }
  return null;
  }
  </code></pre>
  
  <hr>
  
  <pre><code>@Test
  public void testMaxPositionMiddle()
  {
  int[] x = { 1, 5, 3, 7, 8, 9};
  MySorter s = new MySorter();
  assertEquals(1, s.maxPosition(x,2));
  </code></pre>
  
  <h2>    }</h2>
  
  <pre><code>@Test
  public void testMaxPositionFirst()
  {
  int[] x = {5, 1, 3, 2, 8, 9};
  MySorter s = new MySorter();
  assertEquals(0, s.maxPosition(x, 3));
  
  }
  </code></pre>