title: Convert to lower and upper bits
body: <p>I have a device and I have some values  that user sets in GUI, that will be like <code>630</code> <code>330</code> etc. I need these values passed to I2C bytes. 583will be <code>02 47</code> in hex bits. that will be in 2 byte variables and I need to call <code>Set(byte lower ,byte upper)</code> so to convert an int or double value to 2 bytes is the requirement.</p>
  
  <p>I tried : </p>
  
  <pre><code>            ushort R1x = (ushort)Rx;
              byte upper = (byte)(R1x &gt;&gt; 8);
              byte lower = (byte)(R1x &amp; 0xff);
  </code></pre>
  
  <p>What I needed is lower = 47 and upper = 02.</p>
  
  <p>Which is giving <code>lower = 0</code> and <code>upper = 247</code> ..May I know what I am doing wrong</p>