Returns the bottom bits bits from n.
bits
n
static int bottomBits(int n, int bits) => n & ((pow(2, bits)) - 1 as int);