private int pushDownMax(int i) {
        int iBound = queue.size();
        E v = queue.get(i);
        while (true) {
            int iDown = (i << 1) + 1;
            E vDown;
            if (iBound < iDown) {
                break;
            }
            if (iDown == iBound) {
                iDown = iBound - 1;
                vDown = queue.get(iDown);
            }
            else {
                vDown = queue.get(iDown);
                int iRight = iDown + 2;
                if (iRight <= iBound) {
                    if (iRight == iBound) {
                        iRight = iBound - 1;
                    }
                    E vRight = queue.get(iRight);
                    if (less(vDown, vRight)) {
                        vDown = vRight;
                        iDown = iRight;
                    }
                }
            }
            if (!less(v, vDown)) {
                break;
            }
            queue.set(i, vDown);
            i = iDown;
        }
        queue.set(i, v);
        return i;
    }