public void heapfy(int[] input, int i, int size) {
            if (2 * i + 1 >= size) {
                return;
            }
            if (2 * i + 1 == size - 1) {
                int left = input[2 * i + 1];
                int top = input[i];
                input[2 * i + 1] = left > top ? top : left;
                input[i] = left > top ? left : top;
                return;
            }
            int left = input[2 * i + 1];
            int right = input[2 * i + 2];
            int top = input[i];
            if (left > top) {
                if (right > left) {
                    input[i] = right;
                    input[2 * i + 2] = top;
                    heapfy(input, 2 * i + 2, size);
                } else {
                    input[i] = left;
                    input[2 * i + 1] = top;
                    heapfy(input, 2 * i + 1, size);
                }
            } else if (right > top) {
                input[i] = right;
                input[2 * i + 2] = top;
                heapfy(input, 2 * i + 2, size);
            }
        }