@@ -0,0 +1,907 @@
+// page 27%0A%0A// modified to be able to generate a binary file beforehand%0A%0Aimport java.io.*;%0A%0Apublic class BinaryFileCopier %7B%0A%09%0A%09public static void generateInputFile() throws IOException %7B%0A%09%09DataOutputStream dataOutputStream = new DataOutputStream(new FileOutputStream(%22D:%5C%5Cinput.bin%22));%0A%09%09dataOutputStream.writeChars(%22The secret of life is...%22);%0A%09%09dataOutputStream.close();%0A%09%7D%0A%09%0A%09public static void main(String%5B%5D args) throws IOException %7B%0A%09%09generateInputFile();%0A%09%09%0A%09%09FileInputStream inputStream = new FileInputStream(%22D:%5C%5Cinput.bin%22);%0A%09%09FileOutputStream outputStream = new FileOutputStream(%22D:%5C%5Coutput.bin%22);%0A%09%09%0A%09%09byte%5B%5D buffer = new byte%5B1024%5D;%0A%09%09%0A%09%09while (true) %7B%0A%09%09%09int bytesRead = inputStream.read(buffer);%0A%09%09%09if (bytesRead == -1) %7B // if end-of-file reached%0A%09%09%09%09break;%0A%09%09%09%7D%0A%09%09%09outputStream.write(buffer, 0, bytesRead);%0A%09%09%7D%0A%09%09%0A%09%09outputStream.flush();%0A%09%09outputStream.close();%0A%09%09inputStream.close();%0A%09%7D%0A%7D%0A

Create BinaryFileCopier.java