List of utility methods to do Float to Byte Array
byte[] | floatToByte(float[] values) float To Byte if (values == null) { return null; byte[] results = new byte[values.length]; for (int i = 0; i < values.length; i++) { results[i] = (byte) values[i]; return results; ... |
byte[] | floatToByteArray(float number) float to byte array byte[] byteArray = new byte[4]; Integer intBits = Float.floatToIntBits(number); for (int i = 0; i < byteArray.length; i++) { byteArray[i] = new Integer(intBits).byteValue(); intBits = intBits >> 8; return byteArray; |
byte[] | floatToByteArray(float source) float To Byte Array return intToByteArray(Float.floatToRawIntBits(source));
|
byte[] | floatToByteArray(float value) float To Byte Array int l = Float.floatToIntBits(value); return intToByteArray(l); |
byte[] | floatToByteArrayBE(float data) Convert a float to a byte array (big endian). return intToByteArrayBE(Float.floatToRawIntBits(data));
|
byte[] | floatToBytes(final float f) float To Bytes int i = Float.floatToRawIntBits(f); return intToBytes(i); |
byte[] | floatToBytes(float f) float To Bytes return intToBytes(Float.floatToIntBits(f));
|
int | floatToBytes(float fnum, byte[] bytes, int startIndex) translate float into bytes, stored in byte array starting from startIndex return intToBytes(Float.floatToIntBits(fnum), bytes, startIndex);
|
void | floatToBytes(float num, byte[] arr, int pos) Writes a float to 4 bytes in big-endian notation to the byte array. intToBytes(Float.floatToIntBits(num), arr, pos); |
byte[] | floatToBytes(float theFloat) Converts a float into an array of bytes Byte order: big endian byte[] ret = new byte[4]; int floatAsInt = Float.floatToIntBits(theFloat); ret[0] = (byte) ((floatAsInt >>> 24) & BYTESIZE); ret[1] = (byte) ((floatAsInt >>> 16) & BYTESIZE); ret[2] = (byte) ((floatAsInt >>> 8) & BYTESIZE); ret[3] = (byte) ((floatAsInt) & BYTESIZE); return ret; |