code: public void setFormatsByArgumentIndex(Format[] newFormats) {
          if (msgPattern.hasNamedArguments()) {
              throw new IllegalArgumentException(
                      "This method is not available in MessageFormat objects " +
                      "that use alphanumeric argument names.");
          }
          for (int partIndex = 0; (partIndex = nextTopLevelArgStart(partIndex)) >= 0;) {
              int argNumber = msgPattern.getPart(partIndex + 1).getValue();
              if (argNumber < newFormats.length) {
                  setCustomArgStartFormat(partIndex, newFormats[argNumber]);
              }
          }
      }
docs: Sets the Format objects to use for the values passed into
  <code>format</code> methods or returned from <code>parse</code>
  methods. The indices of elements in <code>newFormats</code>
  correspond to the argument indices used in the previously set
  pattern string.
  The order of formats in <code>newFormats</code> thus corresponds 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.
  <p>
  If an argument index is used for more than one format element
  in the pattern string, then the corresponding new format is used
  for all such format elements. If an argument index is not used
  for any format element in the pattern string, then the
  corresponding new format is ignored. If fewer formats are provided
  than needed, then only the formats for argument indices less
  than <code>newFormats.length</code> are replaced.
  
  This method is only supported if the format does not use
  named arguments, otherwise an IllegalArgumentException is thrown.
  
  @param newFormats the new formats to use
  @throws NullPointerException if <code>newFormats</code> is null
  @throws IllegalArgumentException if this formatter uses named arguments