Fastest way to read binary into int[] in java? -
in java, fastest way read huge binary file int[] . saw solution fastest way read huge number of int binary file but there 2 solutions, , don't know better. seem give fixed maximum size int[], how can variable size? how can set fit amount of data in binary exactly. there way know how many ints there in file? thanks you have variables calculate time in both solutions, compare two. while (bytesread != -1) { double start = system.currenttimemillis(); while(doingstuff){} double timetaken = system.currenttimemillis() - start; } as array, use arraylist expandable. arraylist<int> binary = new arraylist<int>(); binary.add(stuff);