import java.util.*; public class RevPriority { public static void main(String[] args) { Random rand = new Random(); PriorityQueue p = new PriorityQueue<>(new Comparator() { public int compare(Integer a, Integer b) { return b - a; } }); for(int i=0;i<10;i++) { p.add(rand.nextInt(1000)); } System.out.println("==="); for(int i=0;i<10;i++) { System.out.println(p.remove()); } } }