porting to java, work in progress - ClusterMaximization.java