title: How to write or append string in loop in a file in java?
body: <p>I'm having memory problem as working with very large dataset and getting memory leaks with char[] and Strings, don't know why! So I am thinking of writing some processed data in a file and not store in memory. So, I want to write texts from an arrayList in a file using a loop. First the program will check if the specific file already exist in the current working directory and if not then create a file with the specific name and start writing texts from the arrayList line by line using a loop; and if the file is already exist then open the file and append the 1st array value after the last line(in a new line) of the file and start writing other array values in a loop line by line. </p>
  
  <p>Can any body suggest me how can I do this in Java? I'm not that good in Java so please provide some sample code if possible.</p>
  
  <p>Thanks!</p>