Here you can find the source of byteArrayToDouble(byte[] byteArray)
Parameter | Description |
---|---|
byteArray | a parameter |
public static double byteArrayToDouble(byte[] byteArray)
//package com.java2s; //License from project: Apache License public class Main { /**/*from w w w . ja v a 2s .c om*/ * byte array to double * * @param byteArray * @return double */ public static double byteArrayToDouble(byte[] byteArray) { double number = 0d; if (byteArray != null && byteArray.length == 8) { long longBits = 0l; longBits = byteArray[0]; longBits &= 0xff; longBits |= ((long) byteArray[1] << 8); longBits &= 0xffff; longBits |= ((long) byteArray[2] << 16); longBits &= 0xffffff; longBits |= ((long) byteArray[3] << 24); longBits &= 0xffffffffl; longBits |= ((long) byteArray[4] << 32); longBits &= 0xffffffffffl; longBits |= ((long) byteArray[5] << 40); longBits &= 0xffffffffffffl; longBits |= ((long) byteArray[6] << 48); longBits &= 0xffffffffffffffl; longBits |= ((long) byteArray[7] << 56); number = Double.longBitsToDouble(longBits); } return number; } }