code: public void formatField(ZonedDateTime datetime, String pattern, StringBuilder buffer) {
      int length = pattern.length();
      if (length == 0) {
        return;
      }
  
      // Current position in pattern
      int i = 0;
  
      // Skip over prefix indicating we want to format a single field.
      if (pattern.charAt(i) == '+') {
        if (length == 1) {
          return;
        }
        i++;
      }
  
      int width = 0;
      char field = pattern.charAt(i);
      while (i < length) {
        if (pattern.charAt(i) != field) {
          break;
        }
        width++;
        i++;
      }
  
      formatField(datetime, field, width, buffer);
    }
docs: Formats a single field, based on the first character in the pattern string,
  with repeated characters indicating the field width.