class Node{ private int value; private Node[] children; boolean hasLeft = false; boolean hasRight = false; public Node(int a){ children = new Node[2]; value = a; } public Node(int a, Node left, Node right){ children = new Node[2]; value = a; children[0] = left; children[1] = right; hasLeft = true; hasRight = true; } public void setLeft(Node left){ children[0] = left; hasLeft = true; } public void setRight(Node right){ children[1] = right; hasRight = true; } public Node getLeft(){ return children[0]; } public Node getRight(){ return children[1]; } public int getValue(){ return value; } public String toString(){ return ""+value; } }