I have this problem with my csv, I have an array with String values and I want to put it in a csv file, but I also want that every element is in a differente column.
I have try this code(without using external framework) and It does not work, the element are in the same colum:
the output is:
first0first1first2
second0second1second2
third0third1third2
BufferedWriter br = new BufferedWriter(new FileWriter("C:/Users/example.csv"));
StringBuilder sb = new StringBuilder();
for (int i=0; i < id.length; i++) {
sb.append(id[i] + "\t");
sb.append(wec[i] + "\t");
sb.append("\n");
}
br.write(sb.toString());
br.close();
}
I have also try the example from here: example1, but nothing is work...here the output is: third0, third1 thir2,
The output that I want, is this:
Colum1 Colum2 Colum3
first0 first1 first2
second0 second1 second2
third0 third1 third2
I am using Java 7 and Maven, so It is not a problem tu use external libreries.
I want that all my element are separeted by column, not "," or other symbol. Here the expected output: expected output

\twith<blank>. Or do you want Comma Separated Values as output? Then replace\twith,or;.