code: public static int indexOf(byte[] buffer, char ch) {
          if (buffer == null) {
              return -1;
          }
          for (int index = 0; index < buffer.length; index++) {
              if (buffer[index] == ch) {
                  return index;
              }
          }
          return -1;
      }
docs: Return the first index where the given character occurs in the given buffer or -1
  if is not found. This is like String.indexOf() but it works on byte[] arrays. If
  the given buffer is null or empty, -1 is returned.
  
  @param buffer    byte[] to search.
  @param ch        Character to find.
  @return          Zero-relative index where character was first found or -1 if the
  character does not occur or is not found.