code: @Override
    public int indexOf(byte b) {
      if (hasArray()) {
        int arrayOffset = arrayOffset();
        int beginPos = arrayOffset + position();
        int limit = arrayOffset + limit();
        byte[] array = array();
  
        for (int i = beginPos; i < limit; i++) {
          if (array[i] == b) {
            return i - arrayOffset;
          }
        }
      } else {
        int beginPos = position();
        int limit = limit();
  
        for (int i = beginPos; i < limit; i++) {
          if (get(i) == b) {
            return i;
          }
        }
      }
  
      return -1;
    }
docs: {@inheritDoc}