title: More Efficient RGB to ARGB Conversion
body: <p>I have this working code which reads in a 700x700 RGB24 TIF file and places it into display memory. The line which assigns the <code>pixelARGB</code> value appears to be extremely inefficient, this code takes 3-4 seconds to redraw the screen. <em>Is there a way I can avoid the shifting and oring and just place the byte values into the correct position within the 32 bit word?</em>
  In other languages I have done this with "overlayed variables" or "variant records" or such. Cannot find this in Java. Thank you.</p>
  
  <pre><code>for (y=0; y&lt;700; y++) { // for each line
      i = 0;
      for (x=0; x&lt;700; x++) { // for each dot
          red = lineBuf[i++] &amp; 0xFF;
          green = lineBuf[i++] &amp; 0xFF;
          blue = lineBuf[i++]&amp; 0xFF;
          pixelARGB = 0xFF000000 | (red &lt;&lt; 16)| (green &lt;&lt; 8) | blue;
          this_g.setPixel(x + BORDER, y + BORDER, pixelARGB);
      }
      size=is.read(lineBuf,0,2100);
  }
  </code></pre>