static final int AGE = 1; static final int ADDRESS = 2; static final int SEX = 4; static final int OTHERS = 8;
public static void main(String[] args) { int judge = 0;
judge = judge | AGE; judge = judge | ADDRESS;
if ((judge & AGE) == AGE) { if ((judge & ADDRESS) == ADDRESS) { System.out.println("Your age and address is OK"); } else { System.out.println("Your address is NG"); } } else { System.out.println("Your age is NG"); } } }