Create a FileOutputStream. In a loop, read() from the InputStream and write() the result to the FileOutputStream until read() returns -1, then flush() and close() all streams. Plenty of examples in The Java Tutorial