Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public static float[] getFloatC(String filename)
throws FileNotFoundException, IOException{
File fl = new File(filename);
FileInputStream str = new FileInputStream(fl);
FileChannel ch = str.getChannel();
MappedByteBuffer mb = FileChannel.MapMode.READ_ONLY, 0L, ch.size( ));
int numfloats = (int) ch.size()/4;
float[] result = new float [numfloats];
for(int j=0;j<numfloats;j++){
result [j] = mb.getFloat();
} finally{
return result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment