Question: Write an expression that results in the least significant byte of an integer x staying the same, but all other bits complemented. For example: 0x98234493
Write an expression that results in the least significant byte of an integer x staying the same, but all other bits complemented. For example: 0x98234493 becomes 0x67dcbb93
"Expression" means that you should write simple code that doesn't involve looping. Use bitwise operators like AND (&), OR(|), NOT(~), XOR(^), shift left logical (<<), shift right logical (>>>), shift right arithmetic (>>).You should try to solve each of these problems on paper before writing the code.
public class Puzzles {
public static int Q1(int x) { return 0;
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
