java 8 made the task easy. Now you have String.join() method where first parameter is separator and then you can pass either multiple strings or some instance of Iterable having instances of strings as second parameter . It will return the CSV in return. package com.seo; import java.time.ZoneId; public class StringDEMO { public static void main(String[] args){ String joined = String.join( "/" , "test" , "test1" , "test2" ); System.out.println(joined); String ids = String.join( ", " , ZoneId.getAvailableZoneIds()); System.out.println(ids); } } Output: test/test1/test2 Asia/Aden, America/Cuiaba, Etc/GMT+ 9 , Etc/GMT+ 8 .....