code: public static String concat(String[] array, String separator, int fromIndex, int toIndex) {
      StringBuilder buf = new StringBuilder();
      for (int i = fromIndex; i <= toIndex; i++) {
        if (buf.length() > 0)
          buf.append(separator);
        buf.append(array[i]);
      }
      return buf.toString();
    }
docs: Concats elements in array between <tt>fromIndex</tt>, inclusive, to <tt>toIndex</tt>,
  inclusive, inserting <tt>separator</tt> between them.