title: have a problem sorting priority queue integers
body: <p>hello i wonder what's wrong with my code:
  It should have an output like this:</p>
  <p><a href="https://i.stack.imgur.com/xkHlr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xkHlr.png" alt="enter image description here" /></a></p>
  <p>in this problem  I need to implement different queue operations  by adding element, removing element, size of priority queue, print the queue and top element of queue</p>
  <p>Input Format</p>
  <p>The first line of input contains an integer T denoting the no of test cases. For each test case, the first line of input contains an integer Q denoting the no of queries followed by Q space separated queries. A query can be of the following types:</p>
  <p>1.x (Adding x to the priority queue and print the queue)</p>
  <p>2.(Removing the element from the top of the priority queue and printing that element )</p>
  <p>3.(Get the element at the top of the priority queue)</p>
  <p>4.(Get the size of the priority queue)</p>
  <p>5.(Print the priority queue)</p>
  <pre><code>import java.util.Comparator;
  import java.util.PriorityQueue;
  import java.util.Scanner;
  
  class Solution {
  
      public static void main(String args[]) {
          Scanner scanner= new Scanner(System.in);
          int T=scanner.nextInt();
          int i=0;
          int Q=scanner.nextInt();
          System.out.println();
          PriorityQueue&lt;Integer&gt;pq=new PriorityQueue&lt;&gt;(new Comparator&lt;Integer&gt;() {
              @Override
              public int compare(Integer o1, Integer o2) {
                  return o2.compareTo(o1);
              }
          });
          while (i&lt;T){
              for (int j = 0; j &lt; Q; j++) {
  
  
                  int query=scanner.nextInt();
  
                  switch (query){
                      case 1:
  
                          pq.add(scanner.nextInt());
                          System.out.println(pq.toString().replace(&quot;[&quot;,&quot;&quot;).replace(&quot;]&quot;,&quot;&quot;).replace(&quot;,&quot;,&quot;&quot;));
                          break;
                      case 2:
                          System.out.println(pq.poll());
                          break;
                      case 3:
  
                          System.out.println(pq.peek());
                          break;
                      case 4:
                          System.out.println(pq.size());
                          break;
                      case 5:
                          System.out.println(pq.toString().replace(&quot;[&quot;,&quot;&quot;).replace(&quot;]&quot;,&quot;&quot;).replace(&quot;,&quot;,&quot;&quot;));
                      default:
                          break;
                  }}
              i++;
          }}
  }
  
  </code></pre>
  <p>but when I'm running my code it gives me  output like this:</p>
  <p><a href="https://i.stack.imgur.com/MoUsV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MoUsV.png" alt="enter image description here" /></a></p>