count good nodes in binary tree java