static int writeElement(final Bytes value, final MutableBytes dest, final int destOffset) {
    final int size = value.size();
    if (isSingleRLPByte(value)) {
      dest.set(destOffset, value.get(0));
      return destOffset + 1;
    }

    if (isShortElement(value)) {
      dest.set(destOffset, (byte) (0x80 + size));
      value.copyTo(dest, destOffset + 1);
      return destOffset + 1 + size;
    }

    final int offset = writeLongMetadata(0xb7, size, dest, destOffset);
    value.copyTo(dest, offset);
    return offset + size;
  }
Writes the result of encoding the provided value to the provided destination (which must be big
enough).
ethereum/rlp/src/main/java/org/hyperledger/besu/ethereum/rlp/RLPEncodingHelpers.java