public byte[] encodeDouble(double d, byte[] ret) {
try {
long l = Double.doubleToRawLongBits(d);
@SuppressWarnings("resource")
DataOutputStream dos = new DataOutputStream(new FixedByteArrayOutputStream(ret));
dos.writeLong(l);
return ret;
} catch (IOException ioe) {
throw new RuntimeException(ioe);
}