Java Float to Byte Array floatToByteArray(float value)

Here you can find the source of floatToByteArray(float value)

Description

float To Byte Array

License

Open Source License

Declaration

public static byte[] floatToByteArray(float value) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static byte[] floatToByteArray(float value) {
        int l = Float.floatToIntBits(value);
        return intToByteArray(l);
    }/*w  w  w .ja va2 s.c om*/

    public static byte[] intToByteArray(int value) {
        return new byte[] { (byte) (value >>> 24), (byte) (value >>> 16), (byte) (value >>> 8), (byte) value };
    }
}

Related

  1. floatToByte(float[] values)
  2. floatToByteArray(float number)
  3. floatToByteArray(float source)
  4. floatToByteArrayBE(float data)
  5. floatToBytes(final float f)
  6. floatToBytes(float f)
  7. floatToBytes(float fnum, byte[] bytes, int startIndex)