Here you can find the source of listToString(List
public static String listToString(List<String> args)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static String listToString(List<String> args) { String string = ""; for (int i = 0; i < args.size(); i++) { string += args.get(i) + ((i != (args.size() - 1)) ? " " : ""); }/* www . jav a2 s. co m*/ return string; } }