Binary literals?
<p>In code, I sometimes see people specify constants in hex format like this:</p>

<pre><code>const int has_nukes        = 0x0001;
const int has_bio_weapons  = 0x0002;
const int has_chem_weapons = 0x0004;
// ...
int arsenal = has_nukes | has_bio_weapons | has_chem_weapons; // all of them
if(arsenal &amp;= has_bio_weapons){
  std::cout &lt;&lt; "BIO!!"
}
</code></pre>

<p>But it doesn't make sense to me to use the hex format here. Is there a way to do it directly in binary? Something like this:</p>

<pre><code>const int has_nukes        = 0b00000000000000000000000000000001;
const int has_bio_weapons  = 0b00000000000000000000000000000010;
const int has_chem_weapons = 0b00000000000000000000000000000100;
// ...
</code></pre>

<p>I know the C/C++ compilers won't compile this, but there must be a workaround? Is it possible in other languages like Java?</p>
