title: How can I mask a hexadecimal int using Java?
body: <p>I have an integer that contains a hexa value. I want to extract the first characters from this hexa value like it was a String value but I don't want to convert it to a String.</p>
  
  <pre><code>int a = 0x63C5;
  int afterMask= a &amp; 0xFFF;
  System.out.println(afterMask); // this gives me "3C5" but I want to get the value "63C" 
  </code></pre>
  
  <p>In my case I can't use String utilities like <code>substring</code>.</p>