static int headerSize(byte magic) {
        if (magic == 0)
            return HEADER_SIZE_V0;
        else if (magic == 1)
            return HEADER_SIZE_V1;
        throw new IllegalArgumentException("Invalid magic used in LegacyRecord: " + magic);
    }
Compute the checksum of the record from the attributes, key and value payloads
clients/src/main/java/org/apache/kafka/common/record/LegacyRecord.java