Question
In Java, please Task: Convert each of the input numbers into the corresponding number in other numbering systems. For example, if the number is in
In Java, please
Task: Convert each of the input numbers into the corresponding number in other numbering systems. For example, if the number is in binary, you should convert that number into their corresponding representations in the decimal and hexadecimal numbering systems. Recall: The nth digit from the right in base b is bn-1 Built in java function that you should not use: Integer.parseInt(num, radix);
Task: Compute the 1s complement (in binary) of every number that was specified at the command line. This will require you to first convert every number into binary. Recall: 1s complement is accomplished by flipping each bit in the binary representation i.e. a 1 becomes a 0, and a 0 becomes a 1. Built in java function that you should not use: ~num
Task: Compute the 2s complement (in binary) of every number that was specified at the command line. This will require you to first convert every number into binary. Recall: 2s comp is accomplished by applying 1s comp then adding 1. See lecture slides Built in java function that you should not use: ~num + 1
Task: Compute the bitwise OR, AND, and XOR of the 3 numbers. This will require you to first convert every number into binary. Recall: OR: If either of the values is a 1 the result is a 1 otherwise it is a 0. AND: If both values are 1 the result is 1 otherwise it is a 0. XOR: If either of the values are 1 and they are not both 1 the value is a 1 otherwise it is a 0. Built in java function that you should not use: num1 | num2, num1 & num2, num1 ^ num2
Task: Compute the bitwise left and right shift of the 3 numbers for 2 shifts. This will require you to first convert every number into binary.
Recall: Left Shift: This is accomplished by appending an x number of 0s. See lecture slides Right Shift: Accomplished by moving each digit to the right x times. See lecture slides Built in java function that you should not use: num1<<2, num1>>2
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started