... scanner.nextInt(); // get first input integer
48                  BitRepresentation.display(first);
49                  second = scanner.nextInt(); // get second input integer
50                  BitRepresentation.display(second);
51                  result = first ^ second; // perform bitwise exclusive OR
52                  System.out.printf(
53                     "\n\n%d ^ %d = %d", first, second, result);
54                  BitRepresentation.display(result);
55                  break;
56               case 4: // Complement
57                  System.out.print("Please enter one integer:");
58                  first = scanner.nextInt(); // get input integer
59                  BitRepresentation.display(first);
60                  result = ~first; // perform bitwise complement on first
61                  System.out.printf("\n\n~%d = %d", first, result);
62                  BitRepresentation.display(result);
63                  break;
64               case 5: default:
65                  System.exit(0); // exit application
66            }
67         }
68 } ...

Get Java How to Program, Early Objects, 11th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.