Java simulation of a frequency allocation algorithm