In Java, DataOutputStream.writeDouble() converts double to long before sending, writing it first with a high byte (Big endian).
However, C #, BinaryReader.ReadDouble() reads in Little Endian Format.
In other words: the byte order is different, and changing one of them should fix your problem.
The easiest way to change the byte order in Java from Big to Little Endian is to use ByteBuffer, where you can specify the type endian: eg:
ByteBuffer buffer = ByteBuffer.allocate(yourvaluehere); buffer.order(ByteOrder.LITTLE_ENDIAN);
Then use DataOutputStream.write()
source share