Returns true if bit is set in n at bitPosition.
n
bitPosition
static bool isSet(int n, int bitPosition) => (n >> bitPosition) & 1 == 1;