how to take max value from priority queue in java

Java
PriorityQueue<Integer> maxPriorityQ = new PriorityQueue<Integer>(Collections.reverseOrder());
Source

Also in Java: