Here you can find the source of doubleToByteArray(double number)
Parameter | Description |
---|---|
number | a parameter |
public static byte[] doubleToByteArray(double number)
//package com.java2s; //License from project: Apache License public class Main { /**/* w ww . ja v a 2 s. com*/ * double to byte array * * @param number * @return byte[] */ public static byte[] doubleToByteArray(double number) { byte[] byteArray = new byte[8]; long longBits = Double.doubleToLongBits(number); for (int i = 0; i < byteArray.length; i++) { byteArray[i] = new Long(longBits).byteValue(); longBits = longBits >> 8; } return byteArray; } }