code: public static String join(final StringBuffer buff, final Object array[],
              final String delim)
     {
        boolean haveDelim = (delim != null);
  
        for (int i = 0; i < array.length; i++)
        {
           buff.append(array[i]);
  
           // if this is the last element then don't append delim
           if (haveDelim && (i + 1) < array.length)
           {
              buff.append(delim);
           }
        }
  
        return buff.toString();
     }
docs: Join an array of strings into one delimited string.
  
  @param buff String buffered used for join (buffer is not reset).
  @param array Array of objects to join as strings.
  @param delim Delimiter to join strings with or <i>null</i>.
  @return Joined string.