Java tutorial
//package com.java2s; import java.util.ArrayList; import java.util.Iterator; public class Main { public static String join(ArrayList<?> param, String sparator) { Iterator<?> it = param.iterator(); StringBuilder sb = new StringBuilder(); while (it.hasNext()) { Object i = it.next(); sb.append(i); if (it.hasNext()) sb.append(sparator); } return sb.toString(); } public static String join(ArrayList<?> param) { return join(param, ","); } }