que-1 how did this logic worked out i know we should do xor of least set bits number and most having unset bit number so that they differ each other and gives large output number but i seen the code i am not getting any clue how it worked.

int value = L ^ r;

value |= value >> 1;

value |= value >> 2;

value |= value >> 4;

value |= value >> 8;

return value;

que-2 how to find the maximum of an array using bitwise xor.