I have an initial list that contains: 1,2,3,4,5,6,7 I want to create an array of StringBuffer that contains only 3 items per element as StringBuffer(String):1,2,34,5,67Initially I resolved this problem as in the following example, but I don't want to use another list to do that:List accounts = new ArrayList();List<Person> listOfObjects = results.getResults();for(Person p: listOfObjects) {   String persAccount = p.getAccount();   accounts.add(persAccount);}String s = listToString(accounts);public String listToString(List list) { StringBuffer b = new StringBuffer();    for (int i = 0; i < list.size(); i++) {        b.append(String.valueOf(list.get(i)));        if (i < list.size()-1)            b.append(',').toString();    }    return b.toString();}I think that an efficent way will be to create a StringBuffer and append all values in the for block.(3 by 3).How can I do it in an efficient way?
Build an Array of StringBuffer with x elements from a List of n elements
java