docs: public Result isUTF8(byte[] buffer, boolean rejectNulls) {
      boolean onlyAscii = true;
  
      for (int i = 0; i < buffer.length; i++) {
        byte len;
        // make it unsigned for the comparisons
        int c = (0xFF) & buffer[i];
  
        if (rejectNulls && c == 0) {
          return Result.INVALID;
        }
        if ((c & 0b10000000) == 0) {
          len = 0;
        } else if (c >= 194 && c < 224) {
          len = 1;
        } else if ((c & 0b11110000) == 0b11100000) {
          len = 2;
        } else if ((c & 0b11111000) == 0b11110000) {
          len = 3;
        } else {
          return Result.INVALID;
        }
  
        while (len > 0) {
          i++;
          if (i >= buffer.length) {
            break;
          }
          c = (0xFF) & buffer[i];
          onlyAscii = false;
  
          // first 2 bits should be 10
          if ((c & 0b11000000) != 0b10000000) {
            return Result.INVALID;
          }
          len--;
        }
      }
  
      return onlyAscii ? new Result(Validation.MAYBE, StandardCharsets.UTF_8) : Result.newValid(StandardCharsets.UTF_8);
    }