This is probably pretty basic, but to save me an hour or so of grief can anyone tell me how you can work out the number of bits required to represent a given positive intege
Well, you can just count how many times you shift right before you're left with just zero:
int value = 11; int count = 0; while (value > 0) { count++; value = value >> 1; }