If you need to create each ArrayList item in a single line then you can use this code
private void createFile(String file, ArrayList arrData)
throws IOException {
FileWriter writer = new FileWriter(file + ".txt");
int size = arrData.size();
for (int i=0;i