for (int i = 0; i < groups.size(); i++) { FieldMap groupFields = (FieldMap)groups.get(i);
for (int i = 0; i < mygroups.size(); i++) { FieldMap groupFields = (FieldMap)mygroups.get(i);
    void calculateString(StringBuffer buffer, int[] preFields, int[] postFields) {        if (preFields != null) {            for (int i = 0; i < preFields.length; i++) {                Field field = getField(preFields[i], null);                field.toString(buffer);                buffer.append('\001');            }        }        for (Iterator iter = fields.values().iterator(); iter.hasNext();) {            Field field = (Field) iter.next();            if (!isOrderedField(field.getField(), preFields)                    && !isOrderedField(field.getField(), postFields)) {                field.toString(buffer);                buffer.append('\001');            }        }        // TODO fix group rendering        for (Iterator iter = groups.entrySet().iterator(); iter.hasNext();) {            Map.Entry entry = (Map.Entry) iter.next();            List groups = (List)entry.getValue();            IntField groupField = new IntField(((Integer)entry.getKey()).intValue());            groupField.setValue(groups.size());            groupField.toString(buffer);            buffer.append('\001');            // Acceptance test copies message with group length field already present            // This causes two fields to be sent.            //buffer.append(entry.getKey()).append("=").append(groups.size()).append('\001');            for (int i = 0; i < groups.size(); i++) {                FieldMap groupFields = (FieldMap)groups.get(i);                groupFields.calculateString(buffer, preFields, postFields);            }        }        if (postFields != null) {            for (int i = 0; i < postFields.length; i++) {                Field field = getField(postFields[i], null);                field.toString(buffer);                buffer.append('\001');            }        }    }