/** * @author lautturi.com * Java example: Float to bytes in java */ import java.util.*; public class Lautturi { public static void main(String[] args) { float value = 1.23f; int intBits = Float.floatToIntBits(value); byte[] bs = new byte[] { (byte) (intBits >> 24), (byte) (intBits >> 16), (byte) (intBits >> 8), (byte) (intBits) }; System.out.println(Arrays.toString(bs)); } }