public void add(int element) { IntBTNode Previous; // put to right Previous = tree; Boolean isNull; isNull = false; while (isNull == false) { if (getData(Previous) <= element) { if (getRighttRef(Previous) == null) { isNull = true; } else { Previous = getRighttRef(Previous); } } else { if (getLeftRef(Previous) == null) { isNull = true; } else { Previous = getLeftRef(Previous); } } } Previous.setData(element); System.out.println("Added " + getData(Previous)); }