public static void writeAllLines(File file, List<String> lines) throws IOException
	{
	    PrintWriter writer = null;
	    try {
	     writer = new PrintWriter(
	             new OutputStreamWriter(
	             new FileOutputStream(file), "windows-1251"));
	     String compared = "";
	     for (String s:lines)
	     {
	    	 compared += s + "\n";
	     }
	     writer.write(compared);
	     writer.close();
	    } catch (Exception ex) {} 
	}