private double calculateEntropy(double... masses){
  double res=0;
  for (  double d : masses) {
    res-=(d == 0) ? 0 : d * Math.log(d);
  }
  return res / LOG2;
}

private double calculateEntropy ( double ... masses ) { double res = 0 ; for ( double d : masses ) { res -= ( d == 0 ) ? 0 : d * Math . log ( d ) ; } return res / LOG2 ; }
calculates the entropy corresponding to the input masses .
