public static double expectedEntropy(int featureIndex, List examples) {
    { double e = 0.0;
      int numExamples = examples.length();
      int p = 0;
      int n = 0;

      { TrainingExample example = null;
        Cons iter000 = examples.theConsList;

        for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
          example = ((TrainingExample)(iter000.value));
          if (Stella_Object.eqlP((example.input.theArray)[featureIndex], Stella.ONE_WRAPPER)) {
            if (BooleanWrapper.coerceWrappedBooleanToBoolean(((BooleanWrapper)(example.output)))) {
              p = p + 1;
            }
            else {
              n = n + 1;
            }
          }
        }
      }
      e = (((double)(p + n)) / numExamples) * Logic.entropy(p, n);
      p = 0;
      n = 0;
      { TrainingExample example = null;
        Cons iter001 = examples.theConsList;

        for (;!(iter001 == Stella.NIL); iter001 = iter001.rest) {
          example = ((TrainingExample)(iter001.value));
          if (Stella_Object.eqlP((example.input.theArray)[featureIndex], Stella.ZERO_WRAPPER)) {
            if (BooleanWrapper.coerceWrappedBooleanToBoolean(((BooleanWrapper)(example.output)))) {
              p = p + 1;
            }
            else {
              n = n + 1;
            }
          }
        }
      }
      e = e + ((((double)(p + n)) / numExamples) * Logic.entropy(p, n));
      return (e);
    }
  }