Here you can find the source of toCsv(Object[] arr, String format)
public static String toCsv(Object[] arr, String format)
//package com.java2s; //License from project: Open Source License public class Main { public static String toCsv(Object[] arr, String format) { String ans = ""; if (arr.length > 0) { ans += String.format(format, arr[0]); }/*from w w w. j a va 2s . c o m*/ String format2 = "," + format; for (int i = 1; i < arr.length; i++) { ans += String.format(format2, arr[i]); } ans += "\n"; return ans; } }