Java tutorial
//package com.java2s; //License from project: Apache License public class Main { public static void putFloat(byte[] bb, float x, int index) { int l = Float.floatToIntBits(x); for (int i = 0; i < 4; i++) { bb[(index + i)] = Integer.valueOf(l).byteValue(); l >>= 8; } } }