completed HorseRace into Java