Here you can find the source of saveToFile(String path, byte[] text)
public static void saveToFile(String path, byte[] text)
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; public class Main { public static void saveToFile(String path, byte[] text) { try {//from w ww . j av a2 s.com Files.write(Paths.get(path), text); } catch (IOException e) { e.printStackTrace(); } } public static void saveToFile(String path, String text) { System.out.println("FileUtil.saveToFile()"); try { Files.write(Paths.get(path), text.getBytes("UTF-8")); } catch (IOException e) { e.printStackTrace(); } } }