Here you can find the source of double2byte(double d)
public static final byte[] double2byte(double d)
//package com.java2s; public class Main { public static final byte[] double2byte(double d) { byte dest[] = new byte[8]; return setdouble(dest, 0, d); }//from www. ja v a 2s .c o m public static final byte[] setdouble(byte dest[], int offset, double d) { return setlong(dest, offset, Double.doubleToLongBits(d)); } public static final byte[] setlong(byte dest[], int offset, long l) { setint(dest, offset, (int) (l >>> 32)); setint(dest, offset + 4, (int) (l & 0xffffffffL)); return dest; } public static final byte[] setint(byte dest[], int offset, int i) { dest[offset] = (byte) (i >>> 24 & 0xff); dest[offset + 1] = (byte) (i >>> 16 & 0xff); dest[offset + 2] = (byte) (i >>> 8 & 0xff); dest[offset + 3] = (byte) (i & 0xff); return dest; } }