Java tutorial
//package com.java2s; public class Main { public static void putDouble(byte[] bb, double x, int index) { // byte[] b = new byte[8]; long l = Double.doubleToLongBits(x); for (int i = 0; i < 4; i++) { bb[index + i] = new Long(l).byteValue(); l = l >> 8; } } }