public static String join(Object[] array, String separator) { if (array == null) { return null; } if (separator == null) { separator = EMPTY; } int arraySize = array.length;     int bufSize = ((arraySize == 0) ? 0 : arraySize * ((array[0] == null ? 16 : array[0].toString().length()) + separator.length()));  StringBuffer buf = new StringBuffer(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 String join(Object[] array) { return join(array, null);
    public static String join(Object[] array, String separator) {        if (array == null) {            return null;        }        if (separator == null) {            separator = EMPTY;        }        int arraySize = array.length;        // ArraySize ==  0: Len = 0        // ArraySize > 0:   Len = NofStrings *(len(firstString) + len(separator))        //           (Assuming that all Strings are roughly equally long)        int bufSize =            ((arraySize == 0)                ? 0                : arraySize                    * ((array[0] == null ? 16 : array[0].toString().length())                        + separator.length()));        StringBuffer buf = new StringBuffer(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();    }