Java Task on Binary Tree