title: Java weird byte array result
body: <p>i'me programming rtp in java for my studies.
  for the header, according to the rfc, i have a 12 bytes array.</p>
  
  <pre><code>The RTP header has the following format:
  
      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |V=2|P|X|  CC   |M|     PT      |       sequence number         |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                           timestamp                           |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |           synchronization source (SSRC) identifier            |
     +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
     |            contributing source (CSRC) identifiers             |
     |                             ....                              |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  </code></pre>
  
  <p>To convert my values, i choose to use an integer per line and then convert it in a byte array.
  My ints (each lines) seems good when displayed in binary but, when converted in a byte array, the first byte look like : 0xff 0xff 0xff 0x[correct value]</p>
  
  <p>It's look like i have 4 bytes in one byte (sound weird)</p>
  
  <p>My int to bytes array function is not from me but look like this :</p>
  
  <pre><code>public static byte[] toByteArray(int number)  {  
      int temp = number;  
      byte[] b=new byte[4];  
      for (int i = b.length - 1; i &gt; -1; i--)   {  
        b[i] = new Integer(temp &amp; 0xff).byteValue();  
        temp = temp &gt;&gt; 8;  
      }  
      return b;  
    } 
  </code></pre>
  
  <p>Do you have any idea where my mistake is from and why this result is possible ?</p>
  
  <p>thx</p>