The following code
System.out.println(\"1 0 0: \" + (true ^ false ^ false)); System.out.println(\"1 0 1: \" + (true ^ false ^ true)); System.out.println(\"1 1 0:
Here's a Java 8 way of determining if exactly one boolean is true:
Stream.of(b1, b2, b3, ...) .filter(b -> b) .count() == 1;