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