public void printTree() {
        Node root = head.getRight();
        if (root == nullNode) {
            return;
        }

        Stack<Node> globalStack = new Stack();
        int emptyLeaf = 32;
        boolean isRowEmpty = false;
        globalStack.push(root);

        while (!isRowEmpty) {
            Stack<Node> localStack = new Stack();
            isRowEmpty = true;

            for (int i = 0; i < emptyLeaf; i++) {
                System.out.print(" ");
            }

            while (!globalStack.isEmpty()) {
                Node temp = globalStack.pop();

                if (temp != nullNode) {
                    System.out.print(temp.getKey());
                    localStack.push(temp.getLeft());
                    localStack.push(temp.getRight());

                    if (temp.getLeft() != nullNode || temp.getRight() != nullNode) {
                        isRowEmpty = false;
                    }
                } else {
                    System.out.print("  ");
                    localStack.push(nullNode);
                    localStack.push(nullNode);
                }
                for (int i = 0; i < emptyLeaf * 2 - 2; i++) {
                    System.out.print(" ");
                }
            }
            System.out.println();
            emptyLeaf /= 2;
            while (!localStack.isEmpty()) {
                globalStack.push(localStack.pop());
            }
        }


    }