threads running a race - Java