title: Android how to construct byte array similar to this
body: <p>I need a little explanation of how can I do something in Java / Android. I need to construct a byte array / data packet so I can send it via http request. I need it to look like this :</p>
  
  <pre><code>- 3 bytes reserved (zero padded)
  - 1 byte - Operation Group
  - 1 byte - Packet type
  - the rest depends on the above
  </code></pre>
  
  <p>But I don't know how can I construct <code>byte[]</code> like this. </p>
  
  <p>Here is what I've tried :</p>
  
  <pre><code>        String padding = "0000000000"; // first part of packet
          String group = "0xA"; // second part of packet
          String type = "02"; // third part of packet
          String content = "ThisIsATestStringWhichYouWillReadButItsADumbAssStringDudeSorryForYou"; // last part of packet
  
          String wholePacket = padding.concat(group.concat(type.concat(content)));
          Log.v("","wholePacket : "+wholePacket);
  
          byte[] bytes = EncodingUtils.getBytes(wholePacket, "UTF-8");
  </code></pre>
  
  <p>Any suggestions?</p>