Android Utililty Methods Byte Array to Double Convert

List of utility methods to do Byte Array to Double Convert

Description

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

Method

doublebytesBE2double(byte[] b, int off)
bytes B Edouble
return Double.longBitsToDouble(bytesBE2long(b, off));
double[]bytesBE2doubles(byte[] b)
bytes B Edoubles
if (b == null)
    return null;
if ((b.length & 0x7) != 0)
    throw new IllegalArgumentException("byte[" + b.length + "]");
double[] val = new double[b.length >> 3];
for (int i = 0; i < val.length; i++)
    val[i] = bytesBE2double(b, i << 3);
return val;
...
doublebytesLE2double(byte[] b, int off)
bytes L Edouble
return Double.longBitsToDouble(bytesLE2long(b, off));
double[]bytesLE2doubles(byte[] b)
bytes L Edoubles
if (b == null)
    return null;
if ((b.length & 0x7) != 0)
    throw new IllegalArgumentException("byte[" + b.length + "]");
double[] val = new double[b.length >> 3];
for (int i = 0; i < val.length; i++)
    val[i] = bytesLE2double(b, i << 3);
return val;
...
doublegetDouble(byte[] b, int index)
get Double
long l;
l = b[index + 0];
l &= 0xff;
l |= ((long) b[index + 1] << 8);
l &= 0xffff;
l |= ((long) b[index + 2] << 16);
l &= 0xffffff;
l |= ((long) b[index + 3] << 24);
...
doublegetDouble(byte[] buf, boolean bigEndian)
Convert byte sequence into java double from first 8 bytes
return Double.longBitsToDouble(getLong(buf, bigEndian));
doublegetDouble(byte[] bytes)
get Double
long l = getLong(bytes);
return Double.longBitsToDouble(l);
doubletoDouble(byte[] b, int pos)
to Double
long l;
l = b[pos];
l &= 0xff;
l |= ((long) b[pos + 1] << 8);
l &= 0xffff;
l |= ((long) b[pos + 2] << 16);
l &= 0xffffff;
l |= ((long) b[pos + 3] << 24);
...
doubletoDouble(byte[] b, int pos, int width)
to Double
double retVal = Double.MAX_VALUE;
switch (width) {
case 1:
case 2:
case 4:
    return (double) toInteger(b, pos, width);
case 8:
    return toDouble(b, pos);
...
doublebyteToDouble(byte[] b)
byte To Double
if (b.length != 8) {
    return -1;
long l;
l = b[0];
l &= 0xff;
l |= ((long) b[1] << 8);
l &= 0xffff;
...