Here you can find the source of floatToByte(float f)
public static byte[] floatToByte(float f)
//package com.java2s; //License from project: Open Source License public class Main { public static byte[] floatToByte(float f) { return intToByte(Float.floatToIntBits(f)); }//from w w w . j av a2s . c o m public static byte[] intToByte(int number) { int temp = number; byte[] b = new byte[4]; for (int i = 0; i < b.length; i++) { b[i] = Long.valueOf(temp & 0xff).byteValue(); temp = temp >> 8; } return b; } }