public static String format ( String [ ] d , String sep ) { if ( d == null ) { return "null" ; } if ( d . length == 0 ) { return "" ; } if ( d . length == 1 ) { return d [ 0 ] ; } int len = sep . length ( ) * ( d . length - 1 ) ; for ( String s : d ) { len += s . length ( ) ; } StringBuilder buffer = new StringBuilder ( len ) // . append ( d [ 0 ] ) ; for ( int i = 1 ; i < d . length ; i ++ ) { buffer . append ( sep ) . append ( d [ i ] ) ; } return buffer . toString ( ) ; }
Formats the string array d with the specified separator .