title: Java hexadecimal
body: <p>I have a message</p>
  
  <pre><code>static int[] message = {
          0x01, 0x10, 0x00,
          0x01, // port addres 01 - 08
          0x00, 0x01, 0x02,
          0x06, 0x00,
          0xA4, 0x21
  };
  </code></pre>
  
  <p>I know the data are right, as of I'm writing them to COM port with RXTX, and I got right HW reaction</p>
  
  <p>I know that <code>0x01</code> is <code>1</code> value, and sent really like <code>01</code> (which is two bits, quarter byte long)</p>
  
  <p>When I need to adjust the message, is generating values like this right?</p>
  
  <pre><code>message[index] = 1 &amp; 0xff
  </code></pre>
  
  <p>I see the output of this snippet, and it looks properly</p>
  
  <pre><code>for (int i = 0; i &lt; 255; i++) {
      System.out.println(i &amp; 0xff);
  }
  </code></pre>
  
  <p>Is there any sheet you'd recommend me to read?<br>
  Is storing these numbers in <code>int</code> right, as we cannot use <code>byte (-128, +127)</code> for values up to <code>&lt;0x00, 0xFF&gt;</code> range</p>