code: public String toPattern() {
          // Return the original, applied pattern string, or else "".
          // Note: This does not take into account
          // - changes from setFormat() and similar methods, or
          // - normalization of apostrophes and arguments, for example,
          //   whether some date/time/number formatter was created via a pattern
          //   but is equivalent to the "medium" default format.
          if (customFormatArgStarts != null) {
              throw new IllegalStateException(
                      "toPattern() is not supported after custom Format objects "+
                      "have been set via setFormat() or similar APIs");
          }
          if (msgPattern == null) {
              return "";
          }
          String originalPattern = msgPattern.getPatternString();
          return originalPattern == null ? "" : originalPattern;
      }
docs: Returns the applied pattern string.
  @return the pattern string
  @throws IllegalStateException after custom Format objects have been set
  via setFormat() or similar APIs