fork download
  1. import java.math.*;
  2.  
  3. class Ideone {
  4. public static void main (String[] args) {
  5. System.out.println(verificaPermissao(BigInteger.valueOf(0), BigInteger.valueOf(0)));
  6. System.out.println(verificaPermissao(BigInteger.valueOf(1), BigInteger.valueOf(1)));
  7. System.out.println(verificaPermissao(BigInteger.valueOf(2), BigInteger.valueOf(1)));
  8. }
  9.  
  10. public static boolean verificaPermissao(BigInteger perm1, BigInteger perm) {
  11. if (perm1 == null || perm == null || (perm1.equals(BigInteger.ZERO) || (perm.equals(BigInteger.ZERO))))
  12. return false;
  13. return !perm.and(perm1).equals(BigInteger.ZERO);
  14. }
  15. }
Success #stdin #stdout 0.07s 3359744KB
stdin
Standard input is empty
stdout
false
true
false