Tree.java

reduce codes in search method