public static Map<String, Integer> calculateRecordLengths(final MetaData columnMD) {
        final Map<String, Integer> recordLengths = new HashMap<String, Integer>();

        // first the basic columns
        int recordLength = 0;
        for (final ColumnMetaData cmd : columnMD.getColumnsNames()) {
            recordLength += cmd.getColLength();
        }

        recordLengths.put(FPConstants.DETAIL_ID, recordLength);

        final Iterator<Entry<String, XMLRecordElement>> columnMDIt = columnMD.xmlRecordIterator();
        while (columnMDIt.hasNext()) {
            final Entry<String, XMLRecordElement> entry = columnMDIt.next();
            final List<ColumnMetaData> cmds = entry.getValue().getColumns();

            recordLength = 0;
            for (final ColumnMetaData cmd : cmds) {
                recordLength += cmd.getColLength();
            }

            recordLengths.put(entry.getKey(), recordLength);
        }

        return recordLengths;

    }