String (List<String> s, String concator, int N, String NthConcator) { StringBuilder result = new StringBuilder(); int i = 1; for (Iterator iterator = s.iterator(); iterator.hasNext(); i++) { String str = (String)iterator.next(); result.append(str); if (iterator.hasNext()) { if (i % N == 0) { result.append(NthConcator); } else { result.append(concator); } } } return result.toString(); }