Skip to content

Instantly share code, notes, and snippets.

Embed
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 = ch.map( FileChannel.MapMode.READ_ONLY, 0L, ch.size( ));
int numfloats = (int) ch.size()/4;
float[] result = new float [numfloats];
try{
for(int j=0;j<numfloats;j++){
result [j] = mb.getFloat();
}
} finally{
str.close();
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.