Java Double Number Create toDouble(byte[] bytes, int index)

Here you can find the source of toDouble(byte[] bytes, int index)

Description

to Double

License

Apache License

Declaration

public static double toDouble(byte[] bytes, int index) 

Method Source Code

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

public class Main {
    public static double toDouble(byte[] bytes, int index) {
        return Double.longBitsToDouble(toLong(bytes, index));
    }//from  w w w.  ja  v a 2 s . co m

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

Related

  1. toDouble(byte[] arr)
  2. toDouble(byte[] b)
  3. toDouble(byte[] byteArray)
  4. toDouble(byte[] bytes)
  5. toDouble(byte[] bytes)
  6. toDouble(byte[] bytes, int offset)
  7. toDouble(byte[] data)
  8. toDouble(byte[] data)
  9. toDouble(byte[] data)