Java BDR exercise