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