Java ByteBuffer store float type data via FloatBuffer and read
import java.nio.ByteBuffer; public class Main { private static final int BSIZE = 1024; public static void main(String[] args) { ByteBuffer bb = ByteBuffer.allocate(BSIZE); bb.rewind();//from w w w . j ava 2 s . co m // Store and read a float: bb.asFloatBuffer().put(123123.123F); System.out.println(bb.getFloat()); } }