Here you can find the source of writeFC(String fname, float[] res)
public static void writeFC(String fname, float[] res) 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 void writeFC(String fname, float[] res) throws IOException { new File(fname).createNewFile(); ByteBuffer bbuffer = ByteBuffer.allocate(4 * res.length); FloatBuffer buffer = bbuffer.asFloatBuffer(); for (int i = 0; i < res.length; i++) buffer.put(res[i]);/* w ww .jav a 2 s . c o m*/ buffer.flip(); FileChannel fc = new RandomAccessFile(fname, "rw").getChannel(); fc.write(bbuffer); fc.close(); } }