code: @Override
      public void evaluate(BinarySolution solution) {
      int counterOnes;
      int counterZeroes;
  
      counterOnes = 0;
      counterZeroes = 0;
  
      BitSet bitset = solution.getVariableValue(0) ;
  
      for (int i = 0; i < bitset.length(); i++) {
        if (bitset.get(i)) {
          counterOnes++;
        } else {
          counterZeroes++;
        }
      }
  
      // OneZeroMax is a maximization problem: multiply by -1 to minimize
      solution.setObjective(0, -1.0 * counterOnes);
      solution.setObjective(1, -1.0 * counterZeroes);
    }
docs: Evaluate() method