title: Given an array with odd length, look at the first, last, and middle values in the array and return an array with those three values
body: <p>So for any given odd length array, I need to look at the first, middle and last value, and return an array with only hose 3 values but in ascending order.This is what I have, but it's only working with arrays of 3 elements, it's not working for other odd length arrays:</p>
  
  <pre><code>public int[] maxTriple(int[] nums) {
  
    int toSwap, indexOfSmallest = 0;
      int i, j, smallest;
  
      for( i = 0; i &lt; nums.length; i ++ )
      {               
  
          smallest = Integer.MAX_VALUE;
  
          for( j = i; j &lt; nums.length; j ++ )
          {
              if( nums[ j ] &lt; smallest )
              {
                  smallest = nums[ j ];
                  indexOfSmallest = j;
              }                   
          }
  
          toSwap = nums[ i ];
          nums[ i ] = smallest;
          nums[ indexOfSmallest ] = toSwap;
      }
  
      return nums;
  }
  </code></pre>