title: Method to merge two queues in a particular order
body: <pre><code>private ArrayQueue&lt;E&gt; merge( ArrayQueue&lt;E&gt; q1, ArrayQueue&lt;E&gt; q2 ) throws ArrayQueueException 
  {
      ArrayQueue&lt;E&gt; mergeQueue = new ArrayQueue&lt;E&gt;( q1.size() + q2.size() );
  
      ArrayQueue&lt;E&gt; smallestQueue = smallestQueue( q1, q2 );
      ArrayQueue&lt;E&gt; biggestQueue = biggestQueue( q1, q2 );
  
      for ( int index = 0; index &lt; smallestQueue.size(); index++ )
      {
          E elementOne = smallestQueue.dequeue();
          E elementTwo = biggestQueue.dequeue();
  
          if ( elementOne.compareTo( elementTwo ) &lt; 0 )
          {
              mergeQueue.enqueue( elementOne );
              mergeQueue.enqueue( elementTwo );
          }
          else
          {
              mergeQueue.enqueue( elementTwo );
              mergeQueue.enqueue( elementOne );
          }
      } 
  
      for ( int index = 0; index &lt; biggestQueue.size(); index++ )
      {
          mergeQueue.enqueue( biggestQueue.dequeue() );
      }
  
      return ( mergeQueue );
  }
  </code></pre>
  
  <p>I have been attemting an exercise which involves creating a method to merge two queues. My attempt above works when both queues are the same size however it is wrong otherwise.</p>
  
  <p>What would be the best way to implement this?</p>
  
  <p>Thanks.</p>