code: public int find(String what, int start) {
          try {
              ByteBuffer src = ByteBuffer.wrap(this.bytes, 0, this.length);
              ByteBuffer tgt = encode(what);
              byte b = tgt.get();
              src.position(start);
  
              while (src.hasRemaining()) {
                  if (b == src.get()) { // matching first byte
                      src.mark(); // save position in loop
                      tgt.mark(); // save position in target
                      boolean found = true;
                      int pos = src.position() - 1;
                      while (tgt.hasRemaining()) {
                          if (!src.hasRemaining()) { // src expired first
                              tgt.reset();
                              src.reset();
                              found = false;
                              break;
                          }
                          if (!(tgt.get() == src.get())) {
                              tgt.reset();
                              src.reset();
                              found = false;
                              break; // no match
                          }
                      }
                      if (found)
                          return pos;
                  }
              }
              return -1; // not found
          } catch (CharacterCodingException e) {
              // can't get here
              e.printStackTrace();
              return -1;
          }
      }
docs: Finds any occurence of <code>what</code> in the backing
  buffer, starting as position <code>start</code>. The starting
  position is measured in bytes and the return value is in
  terms of byte position in the buffer. The backing buffer is
  not converted to a string for this operation.
  @return byte position of the first occurence of the search
  string in the UTF-8 buffer or -1 if not found