Java Utililty Methods Double to Byte Array

List of utility methods to do Double to Byte Array

Description

The list of methods to do Double to Byte Array are organized into topic(s).

Method

byte[]doubleToBytes(double value)
Computes the big-endian byte array representation of the IEEE-754 8 byte encoding of value .
long asLong = Double.doubleToLongBits(value);
return new byte[] { (byte) ((asLong >>> 56) & 0xFF), (byte) ((asLong >>> 48) & 0xFF),
        (byte) ((asLong >>> 40) & 0xFF), (byte) ((asLong >>> 32) & 0xFF), (byte) ((asLong >>> 24) & 0xFF),
        (byte) ((asLong >>> 16) & 0xFF), (byte) ((asLong >>> 8) & 0xFF), (byte) ((asLong >>> 0) & 0xFF) };
byte[]doubleToBytes(final double d)
double To Bytes
long l = Double.doubleToRawLongBits(d);
return longToBytes(l);
byte[]doubleToBytes(final double val)
Encodes the double value as an 8 byte array.
return longToBytes(Double.doubleToRawLongBits(val));
byte[]DoubleToBytes_With_Little_Endian(double number)
Double To Byte Wit Littl Endian
long tmp = Double.doubleToLongBits(number);
byte[] bytes = new byte[8];
for (int i = 0; i < 8; i++) {
    bytes[i] = (byte) (tmp & 0xFF);
    tmp = tmp >> 8;
return bytes;
voidputDouble(byte[] b, double val)
put Double
long j = Double.doubleToLongBits(val);
b[7] = (byte) (j >>> 0);
b[6] = (byte) (j >>> 8);
b[5] = (byte) (j >>> 16);
b[4] = (byte) (j >>> 24);
b[3] = (byte) (j >>> 32);
b[2] = (byte) (j >>> 40);
b[1] = (byte) (j >>> 48);
...
voidputDouble(byte[] data, int i, boolean le, double v)
Puts an IEEE double-precision floating point number into an array of bytes.
if (le)
    putDoubleLE(data, i, v);
else
    putDouble(data, i, v);
byte[]putDouble(double x)
put Double
byte[] b = new byte[8];
putDouble(x, b, 0);
return b;