That could be rewritten as:
if (( nValid & 2#00000001 )); then
#...snip...
fi
if (( nValid & 2#00000010 )); then
#...snip...
fi
with the number of binary digits chosen to be most appropriate for the context. It's not necessary to test for equality if you're only checking one bit*. You could still use the hex representation if it makes more sense. The braces and dollar sign aren't necessary in this context.
You might want to use constants with meaningful names instead of hard-coded values:
declare -r FOO=$((2#00000001))
declare -r BAR=$((2#00000010))
if (( nValid & FOO )); then
#...snip...
fi
if (( nValid & BAR )); then
#...snip...
fi
* You will need to test for equality if you're testing multiple bits at the same time:
if (( (nValid & (FOO | BAR)) == (FOO | BAR) )); then
#...snip...
fi
You will need the extra parentheses since ==
has a higher precedence than the bitwise operators.
Clearing and setting bits in Bash:
(( var |= FOO )) # set the bits in FOO into var
(( var &= ~BAR )) # clear the bits in BAR from var