public static void writeToFile(List<String> lines, File f)
			throws IOException {
		System.out.println("writeToFile function started.");
		String encoding = code(f);
		encoding = "UTF-16LE";
		FileOutputStream fos = new FileOutputStream(f);
		OutputStreamWriter writer = new OutputStreamWriter(fos, encoding);
//		OutputStreamWriter writer = new OutputStreamWriter(fos);
		BufferedWriter bw = new BufferedWriter(writer);
//		bw.w
		for (int i=0; i<lines.size();i++) {
			if(i == 0){
				bw.write("\uFEFF"+lines.get(i));
				if(i != lines.size() - 1){
					bw.newLine();
				}
				continue;
			}
			bw.write(lines.get(i));
			if(i != lines.size() - 1){
				bw.newLine();
			}
		}
		bw.write("\r\n");
		bw.flush();
		writer.flush();
		fos.flush();
		bw.close();
		writer.close();
		fos.close();
		System.out.println("writeToFile function finished.");
	}