Normally, the System.out print stream has a buffer size of 128 and flushes the buffer whenever a newline character is encountered. The following four lines of java change the buffer size to 1024 and doesn't flush the buffer for newline characters.
FileOutputStream fdout = new FileOutputStream(FileDescriptor.out);
BufferedOutputStream bos = new BufferedOutputStream(fdout, 1024);
PrintStream ps = new PrintStream(bos, false);