Here you can find the source of readFC(String fname, int length)
public static float[] readFC(String fname, int length) throws IOException
//package com.java2s; //License from project: Apache License import java.io.*; import java.nio.ByteBuffer; import java.nio.FloatBuffer; import java.nio.channels.FileChannel; public class Main { public static float[] readFC(String fname, int length) throws IOException { float[] res = new float[length]; FileChannel inChannel = new RandomAccessFile(fname, "rw").getChannel(); ByteBuffer buffer = ByteBuffer.allocate(4 * res.length); inChannel.read(buffer);/*from w ww . j a v a 2 s . co m*/ buffer.flip(); FloatBuffer buffer2 = buffer.asFloatBuffer(); for (int i = 0; i < res.length; i++) { res[i] = buffer2.get(i); } inChannel.close(); return res; } }