I have a RandomAccessFile
fileA
, of size 4*k
which has been made by using something like the DataOutputStream.writeInt()
method.
I wish to read it fully into an array int[k]
.
What is the fastest method to do it?
I have considered DataInputStream
around a BufferedInputStream
and also using readFully()
and then shifting those bits manually, but I am unsure how fast the second one would actually be, given the overhead of reading it an extra time. I have yet to look into java.nio
though.
TL;DR: Fast(est) way to fully read a file of integers into an int[]
?
Edit: I am running this on a remote machine where I only have access to the JVM memory, without the ability to memory map files.