Here you can find the source of floatToByte(float d)
public static byte[] floatToByte(float d)
//package com.java2s; //License from project: Apache License public class Main { public static byte[] floatToByte(float d) { byte[] bytes = new byte[4]; int l = Float.floatToIntBits(d); for (int i = 0; i < bytes.length; i++) { bytes[i] = Integer.valueOf(l).byteValue(); l = l >> 8;//from w ww . j a v a 2s . c o m } return bytes; } }