Java tutorial
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.io.OutputStream; public class Main { public static void writeDouble(OutputStream out, double d) throws IOException { long l = Double.doubleToRawLongBits(d); out.write(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) }); } }