Question: For this assignment, please create a java class called BitFiddlingPractice. It should have four methods. public static int getFourthLeastSignificantBit(int x) This should return the value
For this assignment, please create a java class called BitFiddlingPractice.
It should have four methods.
- public static int getFourthLeastSignificantBit(int x) This should return the value of the fourth least significant bit of x (which will have value either 0 or 1).
- public static int getMostSignificantBit(int x) This should return the value of the most significant bit of x (which will have value either 0 or 1).
- public static int setFourthLeastSignificantBitToOne(int x) This should return x except that if its fourth least significant bit was not already 1, it should now be changed to 1. The other bits should stay the same.
- public static int getThreeLeastSignificantBits(int x) This should return a number between 0 and 7 representing the three least significant bits from x.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
