In Java PriorityQueue can be used as a Heap. Min Heap PriorityQueue<Integer> minHeap = new PriorityQueue<>(); Max Heap: PriorityQueue<Integer> maxHeap = new PriorityQueue<>(Comparator.reverseOrder());