code: public static Bytes toBytes(ByteSequence bs) {
      if (bs.length() == 0) {
        return Bytes.EMPTY;
      }
  
      if (bs.isBackedByArray()) {
        return Bytes.of(bs.getBackingArray(), bs.offset(), bs.length());
      } else {
        return Bytes.of(bs.toArray(), 0, bs.length());
      }
    }
docs: Converts from ByteSequence to Bytes. If the ByteSequence has a backing array, that array (and
  the buffer's offset and limit) are used. Otherwise, a new backing array is created.
  
  @param bs ByteSequence
  @return Bytes object