Java Utililty Methods Byte Array to Double

List of utility methods to do Byte Array to Double

Description

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

Method

doublebytesToDouble(byte[] buffer)
This function converts the bytes in a byte array to its corresponding double value.
return bytesToDouble(buffer, 0);
doublebytesToDouble(byte[] bytes)
bytes To Double
long l = bytesToLong(bytes);
return Double.longBitsToDouble(l);
doublebytesToDouble(byte[] bytes)
bytes To Double
long l;
l = bytes[0];
l &= 0xff;
l |= ((long) bytes[1] << 8);
l &= 0xffff;
l |= ((long) bytes[2] << 16);
l &= 0xffffff;
l |= ((long) bytes[3] << 24);
...
doublebytesToDouble(byte[] bytes, int off)
bytes To Double
long el = 0L;
int shift = 64;
int lim = off + 8;
for (int i = off; i < lim; i++) {
    shift -= 8;
    el |= (long) (bytes[i] & 0xFF) << shift;
return Double.longBitsToDouble(el);
...
doublebytesToDouble(byte[] bytes, int offset)
bytes To Double
return Double.longBitsToDouble(bytesToLong(bytes, offset));
doublebytesToDouble(byte[] bytes, int startIndex)
Given an array of bytes, convert it to a double, least significant byte is stored in the beginning.
return Double.longBitsToDouble(bytesToLong(bytes, startIndex));
doublebytesToDouble(byte[] data, int[] offset)
Return the double represented by the bytes in data staring at offset offset[0].
long bits = bytesToLong(data, offset);
return Double.longBitsToDouble(bits);
doublebytesToDouble(final byte[] bytes)
Parses the byte array into a double.
if (bytes.length < 8) {
    throw new IllegalArgumentException("Byte array must be 8 bytes wide.");
return Double.longBitsToDouble(bytesToLong(bytes));
double[]bytesToDoubles(byte[] b)
bytes To Doubles
double[] d = new double[b.length >> 3];
for (int i = 0; i < d.length; i++) {
    d[i] = Double.longBitsToDouble(readLongFromByteArray(b, i << 3));
return d;
doublebyteToDouble(byte[] b)
byte To Double
long l;
l = b[0];
l &= 0xff;
l |= ((long) b[1] << 8);
l &= 0xffff;
l |= ((long) b[2] << 16);
l &= 0xffffff;
l |= ((long) b[3] << 24);
...