Masking
How about a nice intro to masking? Write the body of this function:
public int extractBit(int num, int pos);
This function should return the value of the bit of "num" at postion "pos".
For example: extractBit(5, 0) would return one, whereas extractBit(16, 2) would return zero.
Hint: Start by looking at how bitwise & works.