Java Assignment Solution on Binary Tree