Java Byte Array to Double byteArrayToDouble(byte[] bytes)

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

Description

byte Array To Double

License

Apache License

Declaration

public static Double byteArrayToDouble(byte[] bytes) 

Method Source Code

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

public class Main {

    public static Double byteArrayToDouble(byte[] bytes) {
        long bits = byteArrayToLong(bytes);
        return Double.longBitsToDouble(bits);
    }/*from w w w  . j  ava2 s.  co m*/

    public static Long byteArrayToLong(byte[] bytes) {
        long number = 0l;
        int byteLength = bytes.length;
        for (int i = 0; i < byteLength; i++) {
            number |= ((long) (bytes[byteLength - i - 1] & 0xff) << (8 * i));
        }
        return number;
    }
}

Related

  1. arr2double(byte[] b)
  2. byteArrayToDouble(byte high[], byte low[])
  3. byteArrayToDouble(byte[] b)
  4. byteArrayToDouble(byte[] byteArray)
  5. byteArrayToDouble(byte[] byteArray)
  6. byteArrayToDoubleArray(final byte[] raw, final boolean bigEndian, final int length)
  7. byteArrayToDoubleBE(byte[] data)
  8. bytes2double(byte[] b)
  9. bytes2double(byte[] bytes)