Java tutorial
//package com.java2s; import java.util.ArrayList; public class Main { public static String joinArrayList(ArrayList<String> args) { return joinArrayList(args, ""); } public static String joinArrayList(ArrayList<String> args, String delimiter) { return joinArrayList(args, delimiter, 0); } public static String joinArrayList(ArrayList<String> args, String delimiter, int startingIndex) { StringBuilder s = new StringBuilder(); for (int i = startingIndex; i < args.size(); i++) { s.append(args.get(i)); if (!(i + 1 >= args.size())) { s.append(delimiter); } } return s.toString(); } }