public MutableBytes getMutableBytes(final long location, final long numBytes) {
    // Note: if length == 0, we don't require any memory expansion, whatever location is. So
    // we must call asByteIndex(location) after this check so as it doesn't throw if the location
    // is too big but the length is 0 (which is somewhat nonsensical, but is exercise by some
    // tests).
    final int length = asByteLength(numBytes);
    if (length == 0) {
      return MutableBytes.EMPTY;
    }

    final int start = asByteIndex(location);

    ensureCapacityForBytes(start, length);
    return MutableBytes.wrap(memBytes, start, length);
  }
Returns a copy of bytes from memory.

@param location The location in memory to start with.
@param numBytes The number of bytes to get.
@return A fresh copy of the bytes from memory starting at {@code location} and extending {@code
    numBytes}.
evm/src/main/java/org/hyperledger/besu/evm/frame/Memory.java