title: Android studio - byte operations - changing value
body: <p>I have a problem with bit operations</p>
  
  <pre><code>int progress = slider.getProgress(); value of user input
  </code></pre>
  
  <p>then I have to do shift left and change it to HEX</p>
  
  <pre><code>int shl = 1&lt;&lt;progress-1;
  String hexStr = Integer.toHexString(shl);
  </code></pre>
  
  <p>Nex Im sending bytes by BT</p>
  
  <pre><code>byte bit = Byte.decode(hexStr)
  command[2]=bit;
  </code></pre>
  
  <p>Now the problem
  If user set for example 2 it is ok 0b100 = 0x04 </p>
  
  <p>But if user set 5 0b10000 = hexStr = 10 in command[2] it gets value 0x0A</p>
  
  <p>Why is it changing value?</p>