title: ByteBuffer.PutDouble equivalent in C#
body: <p>I have a double(float/Decimal) value and I want to get the same byte array as produced by Java ByteBuffer in C#. 
  However the byte array produced by using ByteBuffer.PutDouble in Java and BinaryWriter in C# is different. Can someone please explain the implementation detail difference between the two.</p>
  
  <p>Java:</p>
  
  <pre><code>ByteBuffer bytes = ByteBuffer.allocate(8).putDouble(0,1.12346);
  </code></pre>
  
  <p>bytes[] = {63, -15, -7, -83, -45, 115, -106, 54};</p>
  
  <p>C#:</p>
  
  <pre><code>double value = 1.12346;
  byte[] arr;
  using (MemoryStream stream = new MemoryStream())
  {
     using (BinaryWriter writer = new BinaryWriter(stream))
     {
        writer.Write(value);
        arr = stream.ToArray();
     }
  }
  </code></pre>
  
  <p>arr[] = {153, 211, 101, 49, 177, 249, 241, 63};</p>