Here you can find the source of writeToTextFile(String fileName, String content)
public static void writeToTextFile(String fileName, String content) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; public class Main { public static void writeToTextFile(String fileName, String content) throws IOException { Files.write(Paths.get(fileName), content.getBytes(), StandardOpenOption.CREATE); }/* w w w. j a v a 2 s . c o m*/ }