android - new to java: what are the bits between i and j in 10000000000 -
i have been asked solved following problem:
you given 2 32-bit numbers, n , m, , 2 bit positions, , j. write method set bits between , j in n equal m (e.g., m becomes substring of n located @ , starting @ j). example: input: n = 10000000000, m = 10101, = 2, j = 6 output: n = 10001010100
what dont understand, bits between , j in 10000000000 ? can explain me ?
i have familarity bitwise operations, has totally confused me.
from example, looks bits numbered right left, starting @ 0:
n 1 0 0 0 0 0 0 0 0 0 0 position # 10 9 8 7 6 5 4 3 2 1 0 ^ ^ j=6 i=2 \_______/ | these bits between , j in n.
Comments
Post a Comment