Java tutorial
import java.io.BufferedOutputStream; import java.io.FileOutputStream; import java.io.PrintStream; public class Main { public static void main(String[] argv) throws Exception { System.setOut(new PrintStream(new BufferedOutputStream(new FileOutputStream("output.dat")))); } }