title: iOS: how to add length of a NSData as its two bytes header?
body: <p>I have a NSData and I would like to append its length in its header as hex digits. I am able to do this using following code:</p>
  
  <pre><code>unsigned int len = [data length];
  
  NSMutableData *sendData = [[NSMutableData alloc] initWithBytes:&amp;len length:2];
  [sendData appendData:data];
  </code></pre>
  
  <p>result from above code for len = 5 is "05 00" but I want "00 05" instead. Does anyone know how to do that?</p>
  
  <p>Header is always going to be of length 2.</p>
  
  <p>Thanks,</p>