code: public void setFormats(Format[] newFormats) {
          int runsToCopy = newFormats.length;
          if (runsToCopy > maxOffset + 1) {
              runsToCopy = maxOffset + 1;
          }
          for (int i = 0; i < runsToCopy; i++) {
              formats[i] = newFormats[i];
          }
      }
docs: Sets the formats to use for the format elements in the
  previously set pattern string.
  The order of formats in <code>newFormats</code> corresponds to
  the order of format elements in the pattern string.
  <p>
  If more formats are provided than needed by the pattern string,
  the remaining ones are ignored. If fewer formats are provided
  than needed, then only the first <code>newFormats.length</code>
  formats are replaced.
  <p>
  Since the order of format elements in a pattern string often
  changes during localization, it is generally better to use the
  {@link #setFormatsByArgumentIndex setFormatsByArgumentIndex}
  method, which assumes an order of formats corresponding to the
  order of elements in the <code>arguments</code> array passed to
  the <code>format</code> methods or the result array returned by
  the <code>parse</code> methods.
  
  @param newFormats the new formats to use
  @exception NullPointerException if <code>newFormats</code> is null