I am using Java to convert a double into a byte array. Like this:
public static byte[] toByteArray(double value) {
byte[] bytes = new byte[8];
ByteBuffer.wrap(bytes).putDouble(value);
return bytes;
}
Now, I would like to convert this byte array back into a double. In Java I would do it like this:
public static double toDouble(byte[] bytes) {
return ByteBuffer.wrap(bytes).getDouble();
}
Now, how can I write the toDouble() method in Python?