Java Float to Byte Array FloatToBytesLE(final float value)

Here you can find the source of FloatToBytesLE(final float value)

Description

Float To Bytes LE

License

Creative Commons License

Declaration

public final static byte[] FloatToBytesLE(final float value) 

Method Source Code

//package com.java2s;
//License from project: Creative Commons License 

public class Main {
    public final static byte[] FloatToBytesLE(final float value) {
        return IntToBytesLE(Float.floatToIntBits(value));
    }/*from ww w  . j  a v a  2 s  . co m*/

    public final static byte[] IntToBytesLE(final long val) {
        byte[] buf = new byte[4];

        for (int i = 0; i < 4; i++) {
            buf[i] = (byte) (val >>> (8 * i));
        }

        return buf;
    }
}

Related

  1. floatToBytes(final float f)
  2. floatToBytes(float f)
  3. floatToBytes(float fnum, byte[] bytes, int startIndex)
  4. floatToBytes(float num, byte[] arr, int pos)
  5. floatToBytes(float theFloat)
  6. floatToBytesLE(float f, byte[] bytes, int off)