protected final StringBuffer formatInternal (Object arguments[], StringBuffer appendBuf,
private StringBuffer formatInternal (Object arguments[], StringBuffer appendBuf,
  protected final StringBuffer formatInternal (Object arguments[], StringBuffer appendBuf,					       FieldPosition fp,					       FormatCharacterIterator output_iterator)  {    appendBuf.append(leader);    if (output_iterator != null)      output_iterator.append(leader);    for (int i = 0; i < elements.length; ++i)      {	Object thisArg = null;	boolean unavailable = false;	if (arguments == null || elements[i].argNumber >= arguments.length)	  unavailable = true;	else	  thisArg = arguments[elements[i].argNumber];	AttributedCharacterIterator iterator = null;	Format formatter = null;	if (fp != null && i == fp.getField() && fp.getFieldAttribute() == Field.ARGUMENT)	  fp.setBeginIndex(appendBuf.length());	if (unavailable)	  appendBuf.append("{" + elements[i].argNumber + "}");	else	  {	if (elements[i].setFormat != null)	  formatter = elements[i].setFormat;	else if (elements[i].format != null)	  {	    if (elements[i].formatClass != null		&& ! elements[i].formatClass.isInstance(thisArg))	      throw new IllegalArgumentException("Wrong format class");	    	    formatter = elements[i].format;	  }	else if (thisArg instanceof Number)	  formatter = NumberFormat.getInstance(locale);	else if (thisArg instanceof Date)	  formatter = DateFormat.getTimeInstance(DateFormat.DEFAULT, locale);	else	  appendBuf.append(thisArg);	  }	if (fp != null && fp.getField() == i && fp.getFieldAttribute() == Field.ARGUMENT)	  fp.setEndIndex(appendBuf.length());	if (formatter != null)	  {	    // Special-case ChoiceFormat.	    if (formatter instanceof ChoiceFormat)	      {		StringBuffer buf = new StringBuffer ();		formatter.format(thisArg, buf, fp);		MessageFormat mf = new MessageFormat ();		mf.setLocale(locale);		mf.applyPattern(buf.toString());		mf.format(arguments, appendBuf, fp);	      }	    else	      {		if (output_iterator != null)		  iterator = formatter.formatToCharacterIterator(thisArg);		else		  formatter.format(thisArg, appendBuf, fp);	      }	    elements[i].format = formatter;	  }	if (output_iterator != null)	  {	    HashMap hash_argument = new HashMap();	    int position = output_iterator.getEndIndex();	    	    hash_argument.put (MessageFormat.Field.ARGUMENT,			       new Integer(elements[i].argNumber));	    	    if (iterator != null)	      {		output_iterator.append(iterator);		output_iterator.addAttributes(hash_argument, position, 					      output_iterator.getEndIndex());	      }	    else	      output_iterator.append(thisArg.toString(), hash_argument);	    	    output_iterator.append(elements[i].trailer);	  }	appendBuf.append(elements[i].trailer);      }    return appendBuf;  }