title: Maximum priority queue functions
body: <p>I define a maximum priority queue as below:</p>
  <pre><code>    PriorityQueue&lt;Integer&gt; queue = new PriorityQueue&lt;&gt;(Collections.reverseOrder());
  
      queue.add(25);
      queue.add(3);
      queue.add(1);
      queue.add(3);
      queue.add(4);
  </code></pre>
  <p>I need to understand how this works especially when does the 1 gets the index of 2 only (not 4)?</p>
  <p>Thanks.</p>
  <p><a href="https://i.stack.imgur.com/0HyJh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0HyJh.png" alt="enter image description here" /></a></p>