java Bicoloring Solution