June 2017
Beginner
1296 pages
69h 23m
English
... 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 } ...Read now
Unlock full access