code: public void setFormat(int formatElementIndex, Format newFormat) {
          if (formatElementIndex > maxOffset) {
              throw new ArrayIndexOutOfBoundsException(maxOffset, formatElementIndex);
          }
          formats[formatElementIndex] = newFormat;
      }
docs: Sets the format to use for the format element with the given
  format element index within the previously set pattern string.
  The format element index is the zero-based number of the format
  element counting from the start of the pattern string.
  <p>
  Since the order of format elements in a pattern string often
  changes during localization, it is generally better to use the
  {@link #setFormatByArgumentIndex setFormatByArgumentIndex}
  method, which accesses format elements based on the argument
  index they specify.
  
  @param formatElementIndex the index of a format element within the pattern
  @param newFormat the format to use for the specified format element
  @exception ArrayIndexOutOfBoundsException if {@code formatElementIndex} is equal to or
  larger than the number of format elements in the pattern string