Java Byte Array to Double byteToDouble(byte[] b)

Here you can find the source of byteToDouble(byte[] b)

Description

byte To Double

License

Apache License

Declaration

public static double byteToDouble(byte[] b) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static double byteToDouble(byte[] b) {
        long l;//  w ww.  j ava 2s . c  om
        l = b[0];
        l &= 0xff;
        l |= ((long) b[1] << 8);
        l &= 0xffff;
        l |= ((long) b[2] << 16);
        l &= 0xffffff;
        l |= ((long) b[3] << 24);
        l &= 0xffffffffl;
        l |= ((long) b[4] << 32);
        l &= 0xffffffffffl;

        l |= ((long) b[5] << 40);
        l &= 0xffffffffffffl;
        l |= ((long) b[6] << 48);
        l &= 0xffffffffffffffl;

        l |= ((long) b[7] << 56);

        return Double.longBitsToDouble(l);
    }
}

Related

  1. bytesToDouble(byte[] bytes, int offset)
  2. bytesToDouble(byte[] bytes, int startIndex)
  3. bytesToDouble(byte[] data, int[] offset)
  4. bytesToDouble(final byte[] bytes)
  5. bytesToDoubles(byte[] b)
  6. byteToDouble(byte[] bytes)
  7. byteToDouble(byte[] paramArrayOfByte)
  8. byteToDoubleArray(byte[] ar)