title: Byte array to int16 conversion
body: <p>How would one take a byte array and convert it into a multidimensional integer array.  The real data would actually be the results of a System.IO.BinaryReader using ReadBytes.  The function would take the byte array and output the new array.</p>
  
  <p>For instance, the given data would have the first 4 elements in a 4xN array of 
  256, 328, 344, 546</p>
  
  <p>The following conversion works for a single pair of bytes </p>
  
  <pre><code>let value = int bytedata.[1] ||| (int bytedata.[0] &lt;&lt;&lt; 8)
  </code></pre>
  
  <p>I can do it with looping, however it seems that F# should make this easier.</p>
  
  <pre><code>let realdata =  [|1uy; 0uy; 1uy; 48uy; 0uy; 158uy; 0uy; 222uy; 0uy; 250uy; 0uy; 0uy; 0uy;
  151uy; 2uy; 238uy; 3uy; 31uy; 1uy; 191uy; 1uy; 228uy; 1uy; 62uy; 1uy;
  111uy; 0uy; 247uy; 1uy; 183uy; 0uy; 83uy; 0uy; 213uy; 2uy; 197uy; 2uy;
  161uy; 1uy; 7uy; 0uy; 201uy; 1uy; 48uy; 0uy; 166uy; 0uy; 133uy; 1uy; 40uy;
  0uy; 150uy; 0uy; 193uy; 2uy; 207uy; 2uy; 217uy; 1uy; 158uy; 1uy; 53uy; 1uy;
  38uy; 0uy; 141uy; 0uy; 162uy; 1uy; 23uy; 0uy; 0uy; 0uy; 128uy; 2uy; 223uy;
  2uy; 204uy; 1uy; 236uy; 2uy; 20uy; 1uy; 56uy; 0uy; 221uy; 0uy; 235uy; 1uy;
  118uy; 0uy; 29uy; 0uy; 173uy; 2uy; 58uy; 2uy; 27uy; 1uy; 56uy;|]
  
  let convertBytes (data : byte[]) =
  seq { 
      let i = ref 0
      while !i &lt; 10 do
          if !i%2 = 0 then 
              yield int(data.[!i] ||| (data.[!i+1] &lt;&lt;&lt; 8))
          i := !i + 2
  }
  </code></pre>
  
  <p>However, I'm yielding a byte array rather than a int16 array.</p>
  
  <p>Don </p>