Here you can find the source of double2bytes(double v, int len)
public static byte[] double2bytes(double v, int len)
//package com.java2s; //License from project: Apache License public class Main { public static byte[] double2bytes(double v, int len) { byte[] b = new byte[len]; long l = Double.doubleToLongBits(v); for (int i = 0; i < len && i < 8; i++) { b[i] = new Long(l).byteValue(); l = l >> 8;// w w w . j ava 2s . co m } return b; } }