public void maxHeapSort(int[] a){
        buildMaxHeap(a);
        int length = a.length;
        int heapSize = length;
        /**
         * n*O(lgN)=O(n*lgN)
         */
        for (int i = length; i >0; i--)
        {
            swap(a, i-1, 0);
            heapSize=i-1;
            maxheapify(a, 1,heapSize);
        }
    }