Iterator iterator = groups.values().iterator();
Iterator iterator = groups.entrySet().iterator();
    int calculateLength() {        int result = 0;        for (Iterator iter = fields.values().iterator(); iter.hasNext();) {            Field field = (Field) iter.next();            if (field.getField() == BeginString.FIELD || field.getField() == BodyLength.FIELD                    || field.getField() == CheckSum.FIELD) {                continue;            }            result += field.getLength();        }        // TODO handle group field in length calculation                Iterator iterator = groups.values().iterator();        while (iterator.hasNext()) {            List groupList = (List)iterator.next();            for (int i = 0; i < groupList.size(); i++) {                Group group = (Group)groupList.get(i);                result += group.calculateLength();            }        }                return result;    }