title: Java how do you deobfuscatate shift and & values?
body: <p>Lets say I got this for example (from java obfuscation) with a highly overflowed shift value</p>
  
  <pre><code>x = buffer[count + -3] &lt;&lt; 0x8f553768 &amp; 0xff00
  </code></pre>
  
  <p>From trying I figured this out..</p>
  
  <p>8 =  0x ff 00</p>
  
  <p>16 = 0x ff 00 00</p>
  
  <p>24 = 0x ff 00 00 00</p>
  
  <p>pretty much I am deobfuscatating to look like this.</p>
  
  <pre><code>x = ((buffer[coint - 3] &lt;&lt; 8) &amp; 0xff)
  </code></pre>
  
  <p>I got most of it working like flipping the <code>[+ -]</code> to <code>[- +]</code> all this is easy to fix..
  But these shifts are really giving me a hard time.</p>
  
  <p>I found a technique of using AND on the value like
  <code>0x8f553768 &amp; 31</code> which gives the proper answer of <code>8</code> etc..
  Then I would convert <code>0xff00</code> to the equivalent of unsigned byte.. which is <code>0xff</code></p>
  
  <p>My question is how do I lower the bitmasks to it's proper values.. say this example</p>
  
  <pre><code>i1 &lt;&lt; 0xf7c13d2a &amp; 0xfc00      //Aka 0xf7c13d2a &amp; 31 == 10
  </code></pre>
  
  <p>which I got down to..</p>
  
  <pre><code>i1 &lt;&lt; 10 &amp; 0xfc00
  </code></pre>
  
  <p>how do I lower the <code>0xfc00</code> to it's proper value?</p>
  
  <p>I took a <code>guess</code> should look like this</p>
  
  <pre><code>i1 &lt;&lt; 10 &amp; 0x3f
  </code></pre>
  
  <p>but whats the formula to lower <code>AND</code> values?</p>