Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { public static byte[] toByteArray(double d) { long l = Double.doubleToRawLongBits(d); return new byte[] { (byte) ((l >> 56) & 0xff), (byte) ((l >> 48) & 0xff), (byte) ((l >> 40) & 0xff), (byte) ((l >> 32) & 0xff), (byte) ((l >> 24) & 0xff), (byte) ((l >> 16) & 0xff), (byte) ((l >> 8) & 0xff), (byte) (l & 0xff), }; } }