You can use CSVWriter for this with writeAll() method. It doesn’t work on two dimensional array, but it works with Iterable<String[]> or List<String[]>, so you will need to do conversion first.
String[][] table = ...;
List<String[]> convertedTable = Arrays.asList(table);
CSVWriter writer = new CSVWriter(new FileWriter(csvFilename));
writer.writeAll(convertedTable);
writer.close();
2
solved Is there any function to write 2D Array which fetch the data into csv file?