Base on the answers i've got, i think this problem is kind of meaningless. Thanks for all your kind replies!
i want to get a binary number with its rightmost j bits set to 1 and others set to be 0. basically, there are two methods. i wanna know which of them is more efficient, or is there a more efficient way than these two?
1. ~(~0 << j)
2. (1 << j) - 1