java implemented collision avoidance program