title: How to send value bigger than 127 in byte Java
body: <p>I am working on an Smart Card where there is a method in <code>javax.smartcardio.CommandAPDU</code>. </p>
  
  <pre><code>CommandAPDU(int cla, int ins, int p1, int p2, byte[] data, int ne) 
  </code></pre>
  
  <p>I need to send  data as <code>byte[]</code> (5th argument). Now my problem is that, as Java primitive data types are signed the max value of a byte can not exceed 127. I need to send a value bigger than 127. To be precise, the hex value <code>94</code> which is equal to 148. </p>
  
  <p>As some solution suggests that we can cast it to integer.</p>
  
  <pre><code>byte b = -108;
  int i = b &amp; 0xff;
  </code></pre>
  
  <p>I can't do that as the <code>CommandAPDU();</code> constructor doesn't take an <code>[]</code>. So how to do it?</p>