Java tutorial
//package com.java2s; import java.util.ArrayList; public class Main { public static String join(final ArrayList<String> array, String separator) { StringBuffer result = new StringBuffer(); if (array != null && array.size() > 0) { for (String str : array) { result.append(str); result.append(separator); } result.delete(result.length() - 1, result.length()); } return result.toString(); } }