title: Java BigInteger and the Shift operator
body: <p>I have the enum;</p>
  
  <pre class="lang-java prettyprint-override"><code>enum testMe {
      one,
      two,
      three;
  
      long longValue() {
          return 1&lt;&lt;ordinal();
      }
  }
  
  for (testMe myLoop = testMe.values()) {
      System.out.println(value.longValue() + ":" + myLoop);
  }
  </code></pre>
  
  <p>Looping through the enum gives me exactly what I expect for the shift on the ordinal of the values in the enum. However, I need to qualify on an parameter I pass in a long;</p>
  
  <pre><code>Long myLong = 3;
  for (testMe myLoop = testMe.values()) {
      if ((myLong &amp; value.longValue()) != 0) {
          System.out.println(value.longValue() + ":" + myLoop);
      }
  }
  </code></pre>
  
  <p>In this case only the One and Two will be printed. However, this method will only work to 32 values in the enum. Does anyone have any ideas how I could use the BigInteger???</p>
  
  <pre><code>    BigInteger longValue() {
          BigInteger one = BigInteger.valueOf(1);
          return one.shiftLeft(ordinal());
  </code></pre>
  
  <p>Thanks C</p>