read bit from byte
I have this function which gets a byte as an integer and i want it to return the bit from the requested place .
I got this code from someone but i don't understand what "input & (1 << bit) " does.
* Check if selected bit is set in <code>input</code>.
* @param input Value to check
* @param bit Bit number to check (0..7 with 7 MSB)
* @return 1 if bit is set, 0 otherwise
private int getBit(int input, int bit)
if ((input & (1 << bit)) > 0)
thanx in advance
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center