Check out example codes for "create a min heap in java using priority queue". It will help you in understanding the concepts better.

Code Example 1

int arr[]={1,2,1,3,3,5,7};
        PriorityQueue<Integer> a=new PriorityQueue<>();
        for(int i:arr){
            a.add(i);
        }
        while(!a.isEmpty())
            System.out.println(a.poll());

Learn ReactJs, React Native from akashmittal.com