Java code for robot