/// Returns reverse(reverse(key, len) + 1, len).
/// reverse(key, len) is the bit-wise reversal of the len least significant bits of key.
///
private static int GetNextKey(int key, int len)
{
int step = 1 << (len - 1);
while ((key & step) != 0)
{
step >>= 1;
}
return (key & (step - 1)) + step;
}
///