I want to write anything that is in arraylist irrespective of its size in this manner in the csv but one array has less values it causes an array out of bounds error is there any way to work around this?
In this A to H it has it's own arraylist, sometimes the other arrays have less elements in it than size of A this causes array out of bounds.
try{
File file = new File("aaaa.csv");
FileWriter fw = new FileWriter(file);
BufferedWriter bw = new BufferedWriter(fw);
for(int j=0;j<A.size();j++) {
bw.write(A.get(j));
bw.write(","+B.get(j));
bw.write(","+C.get(j));
bw.write(","+D.get(j));
bw.write(","+E.get(j));
bw.write(","+F.get(j));
bw.write(","+G.get(j));
bw.write(","+H.get(j));
bw.newLine();
}
bw.close();
fw.close();
}
catch(IOException e) {
e.printStackTrace();
}