Java tutorial
//package com.java2s; import org.springframework.util.StringUtils; public class Main { public static String joins(String[] arrays, String joinStr) { if (arrays == null) { return ""; } joinStr = StringUtils.hasText(joinStr) ? joinStr : ","; StringBuilder rs = new StringBuilder(); for (String e : arrays) { rs.append(joinStr).append(e); } return rs.length() > 0 ? rs.substring(1) : ""; } }