public static void maxHeapifyNonRecursive(int[] x, int index, int len) {
        int largest = index;

        while (largest == index) {

            int left = index << 1;
            int right = (index << 1) + 1;
            if (left <= len - 1 && x[index] < x[left]) {
                largest = left;
            }
            if (right <= len - 1 && x[largest] < x[right]) {
                largest = right;
            }
            if (largest != index) {
                swap(x, largest, index);
                index = largest;
            } else {
                break;
            }
        }

    }