code: public int indexOf(final byte b, final int from, final int to) {
          int beginIndex = from;
          if (beginIndex < 0) {
              beginIndex = 0;
          }
          int endIndex = to;
          if (endIndex > this.len) {
              endIndex = this.len;
          }
          if (beginIndex > endIndex) {
              return -1;
          }
          for (int i = beginIndex; i < endIndex; i++) {
              if (this.array[i] == b) {
                  return i;
              }
          }
          return -1;
      }
docs: Returns the index within this buffer of the first occurrence of the
  specified byte, starting the search at the specified
  {@code beginIndex} and finishing at {@code endIndex}.
  If no such byte occurs in this buffer within the specified bounds,
  {@code -1} is returned.
  <p>
  There is no restriction on the value of {@code beginIndex} and
  {@code endIndex}. If {@code beginIndex} is negative,
  it has the same effect as if it were zero. If {@code endIndex} is
  greater than {@link #length()}, it has the same effect as if it were
  {@link #length()}. If the {@code beginIndex} is greater than
  the {@code endIndex}, {@code -1} is returned.
  
  @param   b            the byte to search for.
  @param   from         the index to start the search from.
  @param   to           the index to finish the search at.
  @return  the index of the first occurrence of the byte in the buffer
  within the given bounds, or {@code -1} if the byte does
  not occur.
  
  @since 4.1