static String formatMessage ( String fmt , Object [ ] args ) { MessageFormat formatter = new MessageFormat ( fmt ) ; Format [ ] formats = formatter . getFormatsByArgumentIndex ( ) ; StringBuffer msg = new StringBuffer ( ) ; formatter . format ( args , msg , null ) ; if ( args . length > formats . length ) { // We have extra arguements that were not included in the format string. // Append them to the result for ( int i = formats . length ; i < args . length ; i ++ ) { msg . append ( i == formats . length ? ": " : ", " ) //$NON-NLS-1$ //$NON-NLS-2$ . append ( args [ i ] . toString ( ) ) ; } } return msg . toString ( ) ; }
Formats the specified string using the specified arguments . If the argument array contains more elements than the format string can accommodate then the additional arguments are appended to the end of the formatted string .