public static void string2File(final String string2write, final String nameOfFile)
		throws IOException
	{
		try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(nameOfFile)))
		{
			bufferedWriter.write(string2write);
			bufferedWriter.flush();
		}
	}
public static void string2File ( final String string2write , final String nameOfFile ) throws IOException { try ( BufferedWriter bufferedWriter = new BufferedWriter ( new FileWriter ( nameOfFile ) ) ) { bufferedWriter . write ( string2write ) ; bufferedWriter . flush ( ) ; } }
The Method string2File() writes a String to the file.

@param string2write
The String to write into the file.
@param nameOfFile
The path to the file and name from the file from where we want to write the
String.
@throws IOException
Signals that an I/O exception has occurred.