private void writeHashDigests(List<Boolean> digestsDefined, List<Integer> digests) throws IOException {
        int numDefined = 0;
        int i;
        for (i = 0; i < digestsDefined.size(); i++)
            if (digestsDefined.get(i))
                numDefined++;
        if (numDefined == 0)
            return;

        writeByte((byte) Header.NID.kCRC);
        if (numDefined == digestsDefined.size())
            writeByte((byte) 1);
        else {
            writeByte((byte) 0);
            writeBoolList(digestsDefined);
        }
        for (i = 0; i < digests.size(); i++)
            if (digestsDefined.get(i))
                writeUInt32(digests.get(i));
    }