I have a 2 gb file I want to read in Java (actually four 2gb files). And so there\'s a new feature in Java 7 that can let me read all the bytes at once.
impo
Reading byte by byte is the other extreme solution, and will be very inefficient. You should simply use a BufferedInputStream, and read the bytes chunk by chunk.
Read the Java IO tutorial about byte streams.
Try Memory Mapped I/O, the last example in this tutorial: http://www.polarsparc.com/pdf/MemoryMappedIOinJava.pdf