title: Reverse contents of a Queue
body: <p>I have to reverse the contents of a queue, but currently I am experiencing problems with my reverseQueue method. Whenever I print out it prints out the array content twice. If anyone could explain what I am doing wrong will be helpful.</p>
  
  <p>Code: </p>
  
  <pre><code>public static void reverseQueue (Queue Q){
      for (int i = Q.size() -1; i&gt;=0; i--){
          int temp = (int) Q.dequeue();
          Q.enqueue(temp);
          System.out.print(temp+" ");
      }
      }
  </code></pre>
  
  <p>Size method: </p>
  
  <pre><code>public int size(){
      return count;
  }
  </code></pre>
  
  <p>Queue</p>
  
  <pre><code>public class Queue{
  private int QUEUE_SIZE = 5;
  private Object[] items;
  private int front, back, count;
  
  public Queue() {
      items = new Object[QUEUE_SIZE];
      front = 0;
      back = QUEUE_SIZE -1;
      count =0;
  }
  </code></pre>
  
  <p>Example Output:</p>
  
  <p>I am going to reverse my queue.</p>
  
  <p>My queue is as follows:
  20 30 40 50 20 30 40 50 </p>