title: Converting a []byte array (java double encoded) to Float64
body: <p>So, I'm trying to decode a byte array to Float64. I've tried a bunch of different ways, found all over StackOverflow, but no luck so far! <a href="https://play.golang.org/p/7GnRyUy2r0" rel="nofollow noreferrer">Here's the go playground link to what I have tried</a>.
   The expected value should be <code>3177408.5</code>. The original value is a Java double, encoded as IEEE 754 floating-point</p>
  
  <p>Edit:</p>
  
  <p>The value is encoded using the <code>org.apache.hadoop.hbase.util.Bytes.toBytes</code> method. </p>
  
  <pre><code>double v = 3445713.95;
  long ff;
  
  ff = Double.doubleToRawLongBits(v);
  
  bArr = toBytes(ff)
  
  public static byte[] toBytes(long val) {
      byte[] b = new byte[8];
  
      for(int i = 7; i &gt; 0; --i) {
          b[i] = (byte)((int)val);
          val &gt;&gt;&gt;= 8;
      }
  
      b[0] = (byte)((int)val);
      return b;
  }
  </code></pre>
  
  <p>And actually should be: <code>3445713.95</code></p>
  
  <p>Edit2: </p>
  
  <p>My bad for actually just pasting code I was given, without thinking much first, Java is not exactly my cup of tea. Turns out there is a problem somewhere along the pipeline (multiple systems communicating), and value is getting corrupted. I'll mark @Ainar-G's solution as correct, since it actually gives back something close to the expected.</p>