private static void writeFile(File file,List<String> lines) throws IOException {
  if (!file.exists())   file.createNewFile();
  FileWriter fw=new FileWriter(file);
  BufferedWriter Bw=new BufferedWriter(fw);
  PrintWriter pw=new PrintWriter(Bw);
  for (  String line : lines)   pw.println(line);
  Bw.close();
  fw.close();
  pw.close();
}

private static void writeFile ( File file , List < String > lines ) throws IOException { if ( ! file . exists ( ) ) file . createNewFile ( ) ; FileWriter fw = new FileWriter ( file ) ; BufferedWriter Bw = new BufferedWriter ( fw ) ; PrintWriter pw = new PrintWriter ( Bw ) ; for ( String line : lines ) pw . println ( line ) ; Bw . close ( ) ; fw . close ( ) ; pw . close ( ) ; }
writes the lines given in input in file .
