posted 11 months ago

Hi,

I am incredibly new to Java and am having trouble understanding Bitwise Operators. I have an assignment that I have a few questions.

"Write Java statements using the above variables to assign ONLY bits 7, 6, 5, 4 of num1 to bits 11, 10, 9, 8 of num2 (where bit 0 is the right-most least significant bit). The rest of the bits in num2 should be 0, and DON'T CHANGE num1. You MUST use one of the shift operators, as well as one of the logical bitwise operators."

Above is my assignment and I am having trouble figuring out how exactly I start. What exactly does something like "0xFEDC" or "0x0D00" From what I understand after the X wherever there is a letter there is basically a set of 4 binary numbers, whereas when it is a 0, all 4 of the numbers are 0. Can anyone help me understand what exactly these means and how to start with this assignment?

Thank You.

I am incredibly new to Java and am having trouble understanding Bitwise Operators. I have an assignment that I have a few questions.

"Write Java statements using the above variables to assign ONLY bits 7, 6, 5, 4 of num1 to bits 11, 10, 9, 8 of num2 (where bit 0 is the right-most least significant bit). The rest of the bits in num2 should be 0, and DON'T CHANGE num1. You MUST use one of the shift operators, as well as one of the logical bitwise operators."

Above is my assignment and I am having trouble figuring out how exactly I start. What exactly does something like "0xFEDC" or "0x0D00" From what I understand after the X wherever there is a letter there is basically a set of 4 binary numbers, whereas when it is a 0, all 4 of the numbers are 0. Can anyone help me understand what exactly these means and how to start with this assignment?

Thank You.

Don't get me started about those stupid light bulbs. |