private static int writeLongMetadata(
      final int baseCode, final int size, final MutableBytes dest, final int destOffset) {
    final int sizeLength = sizeLength(size);
    dest.set(destOffset, (byte) (baseCode + sizeLength));
    int shift = 0;
    for (int i = 0; i < sizeLength; i++) {
      dest.set(destOffset + sizeLength - i, (byte) (size >> shift));
      shift += 8;
    }
    return destOffset + 1 + sizeLength;
  }
Writes the encoded header of a list provided its encoded payload size to the provided
destination (which must be big enough).
ethereum/rlp/src/main/java/org/hyperledger/besu/ethereum/rlp/RLPEncodingHelpers.java