1012. Complement of Base 10 Integer - notruilin/LeetCode GitHub Wiki
- Find the value of the i-th bit:
    (N >> (i-1)) & 1
- N = 10101, X = 11111, ans = X - N = 01010 Calculate X:
    int X = 1;
    while (X < N) {
        X = X << 1 | 1;
    }
    (N >> (i-1)) & 1
    int X = 1;
    while (X < N) {
        X = X << 1 | 1;
    }