java exercise on kd-tree