Here you can find the source of floatToBytes(float f)
public static byte[] floatToBytes(float f)
//package com.java2s; //License from project: Apache License public class Main { public static byte[] floatToBytes(float f) { return intToBytes(Float.floatToIntBits(f)); }//w w w .j a v a2s.c o m public static byte[] intToBytes(int i) { byte[] b = new byte[4]; b[0] = (byte) (i >>> 24); b[1] = (byte) (i >>> 16); b[2] = (byte) (i >>> 8); b[3] = (byte) i; return b; } }