function valueAtBit(num, bit) {
    var num2 = num.toString(2).split('').reverse();
    return num2[bit-1]
}