fork download
  1. import java.util.*;
  2. import java.lang.*;
  3.  
  4. class Main
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. int a = 0b100010;
  9. int b = 0b001001;
  10.  
  11. int resting = a ^ b;
  12.  
  13. System.out.format("A: %06d%nB: %06d%n", Integer.valueOf(Integer.toBinaryString(a)), Integer.valueOf(Integer.toBinaryString(b)));
  14. System.out.println(" ------");
  15. System.out.format(" %06d%n%n", Integer.valueOf(Integer.toBinaryString(resting)));
  16.  
  17. for (int i = 1; resting != 0; i++) {
  18. boolean isResting = (resting & 1) == 0;
  19.  
  20. if (isResting) {
  21. System.out.println("Player #" + i + " is resting.");
  22. }
  23.  
  24. resting >>>= 1;
  25. }
  26. }
  27. }
Success #stdin #stdout 0.07s 215552KB
stdin
Standard input is empty
stdout
A: 100010
B: 001001
   ------
   101011

Player #3 is resting.
Player #5 is resting.