Android Byte Array to Double Convert getDouble(byte[] bytes)

Here you can find the source of getDouble(byte[] bytes)

Description

get Double

License

Open Source License

Declaration

public static double getDouble(byte[] bytes) 

Method Source Code

//package com.java2s;

public class Main {
    public static double getDouble(byte[] bytes) {
        long l = getLong(bytes);
        return Double.longBitsToDouble(l);
    }//from  www .  j a v  a2  s . c o m

    public static long getLong(byte[] bytes) {
        return (0xffL & (long) bytes[0])
                | (0xff00L & ((long) bytes[1] << 8))
                | (0xff0000L & ((long) bytes[2] << 16))
                | (0xff000000L & ((long) bytes[3] << 24))
                | (0xff00000000L & ((long) bytes[4] << 32))
                | (0xff0000000000L & ((long) bytes[5] << 40))
                | (0xff000000000000L & ((long) bytes[6] << 48))
                | (0xff00000000000000L & ((long) bytes[7] << 56));
    }
}

Related

  1. bytesBE2doubles(byte[] b)
  2. bytesLE2double(byte[] b, int off)
  3. bytesLE2doubles(byte[] b)
  4. getDouble(byte[] b, int index)
  5. getDouble(byte[] buf, boolean bigEndian)
  6. toDouble(byte[] b, int pos)
  7. toDouble(byte[] b, int pos, int width)
  8. byteToDouble(byte[] b)
  9. convertByteArrayToDoubleArray(byte[] bytes)