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[]double2bytearray(double rastervalue)
doublebytearray
long l = Double.doubleToLongBits(rastervalue);
byte[] b = new byte[8];
int shift = 64 - 8;
for (int k = 0; k < 8; k++, shift -= 8) {
    b[k] = (byte) (l >>> shift);
return b;
byte[]double2bytes(double v)
to byte array.
byte[] ret = { 0, 0, 0, 0, 0, 0, 0, 0 };
double2bytes(v, ret);
return ret;
voiddouble2bytes(double v, byte[] b)
doublebytes
double2bytes(v, b, 0);
byte[]double2bytes(double v, int len)
doublebytes
byte[] b = new byte[len];
long l = Double.doubleToLongBits(v);
for (int i = 0; i < len && i < 8; i++) {
    b[i] = new Long(l).byteValue();
    l = l >> 8;
return b;
byte[]double2bytes(double value)
doublebytes
return long2bytes(Double.doubleToLongBits(value));
byte[]double2bytes(double x)
doublebytes
long l = Double.doubleToLongBits(x);
return long2bytes(l);
byte[]double2bytesLE(double val, byte[] b, int off)
doublebytes LE
return long2bytesLE(Double.doubleToLongBits(val), b, off);
byte[]doubleToByteArray(double d)
double To Byte Array
long l = Double.doubleToRawLongBits(d);
return new byte[] { (byte) ((l >> 0) & 0xff), (byte) ((l >> 8) & 0xff), (byte) ((l >> 16) & 0xff),
        (byte) ((l >> 24) & 0xff), (byte) ((l >> 32) & 0xff), (byte) ((l >> 40) & 0xff),
        (byte) ((l >> 48) & 0xff), (byte) ((l >> 56) & 0xff) };
byte[]doubleToByteArray(double number)
double to byte array
byte[] byteArray = new byte[8];
long longBits = Double.doubleToLongBits(number);
for (int i = 0; i < byteArray.length; i++) {
    byteArray[i] = new Long(longBits).byteValue();
    longBits = longBits >> 8;
return byteArray;
byte[]doubleToByteArray(double source)
double To Byte Array
return longToByteArray(Double.doubleToRawLongBits(source));