public void maxHeapify(int[] A, int len, int n) {
        while (n <= len / 2) {
            int max = n;
            int left = n << 1;
            if (left <= len && A[max] < A[left]) {
                max = left;
            }
            int right = (n << 1) + 1;
            if (right <= len && A[max] < A[right]) {
                max = right;
            }
            if (n == max) {
                return;
            }
            swap(A, max, n);
            n = max;
        }
    }