public static <T> String join(T[] array, char separator) {
        if (array == null) {
            return null;
        }

        int arraySize = array.length;
        int bufSize = (arraySize == 0) ? 0 : ((((array[0] == null) ? 16 : array[0].toString()
                .length()) + 1) * arraySize);
        StringBuilder buf = new StringBuilder(bufSize);

        for (int i = 0; i < arraySize; i++) {
            if (i > 0) {
                buf.append(separator);
            }

            if (array[i] != null) {
                buf.append(array[i]);
            }
        }

        return buf.toString();
    }
public static < T > String join ( T [ ] array , char separator ) { if ( array == null ) { return null ; } int arraySize = array . length ; int bufSize = ( arraySize == 0 ) ? 0 : ( ( ( ( array [ 0 ] == null ) ? 16 : array [ 0 ] . toString ( ) . length ( ) ) + 1 ) * arraySize ) ; StringBuilder buf = new StringBuilder ( bufSize ) ; for ( int i = 0 ; i < arraySize ; i ++ ) { if ( i > 0 ) { buf . append ( separator ) ; } if ( array [ i ] != null ) { buf . append ( array [ i ] ) ; } } return buf . toString ( ) ; }
将数组中的元素连接成一个字符串。

<pre>
StringUtil.join(null, *)               = null
StringUtil.join([], *)                 = &quot;&quot;
StringUtil.join([null], *)             = &quot;&quot;
StringUtil.join([&quot;a&quot;, &quot;b&quot;, &quot;c&quot;], ';')  = &quot;a;b;c&quot;
StringUtil.join([&quot;a&quot;, &quot;b&quot;, &quot;c&quot;], null) = &quot;abc&quot;
StringUtil.join([null, &quot;&quot;, &quot;a&quot;], ';')  = &quot;;;a&quot;
</pre>

@param array
要连接的数组
@param separator
分隔符
@return 连接后的字符串，如果原数组为<code>null</code>，则返回<code>null</code>