title: Converting from RGB ints to Hex
body: <p>What I have is R:255 G:181 B:178, and I am working in C# (for WP8, to be more specific)</p>
  
  <p>I would like to convert this to a hex number to use as a color (to set the pixel color of a WriteableBitmap). What I am doing is the following:</p>
  
  <pre><code>int hex = (255 &lt;&lt; 24) | ((byte)R &lt;&lt; 16) | ((byte)G &lt;&lt; 8) | ((Byte)B&lt;&lt;0);
  </code></pre>
  
  <p>But when I do this, I just get blue.</p>
  
  <p>Any ideas what I am doing wrong?</p>
  
  <p>Also, to undo this, to check the RGB values, I am going:</p>
  
  <pre><code>int r = ((byte)(hex &gt;&gt; 16)); // = 0
  int g = ((byte)(hex &gt;&gt; 8)); // = 0
  int b = ((byte)(hex &gt;&gt; 0)); // = 255
  </code></pre>