public boolean isLeaf(Node node) { if(node.getLeft() == null && node.getRight() == null) return true; return false; } public long sumTree(Node root) { if(root == null) return 0; return root.getValue() + sumTree(root.getLeft()) + sumTree(root.getRight()); }