<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">// This client program uses a priority queue to perform
// a version of the "heap sort" sorting algorithm.

import java.util.*;

public class HeapSortMain {
    public static void main(String[] args) {
        int[] a = {0, 65, 50, 20, 90, 44, 60, 80, 70, 99, 10};
        heapSort(a);
        System.out.println(Arrays.toString(a));
    }
    
    public static void heapSort(int[] a) {
        Queue&lt;Integer&gt; pq = new PriorityQueue&lt;Integer&gt;();
        for (int n : a) {
            pq.add(n);
        }
        for (int i = 0; i &lt; a.length; i++) {
            a[i] = pq.remove();
        }
    }
}
</pre></body></html>