i get confused when i readed the code snippet
long lastWordMask = WORD_MASK >>> -toIndex;
but toIndex is positive, i wonder what is going on if a negative number come after the operator(>>>)
any help will be appreciated
i get confused when i readed the code snippet
long lastWordMask = WORD_MASK >>> -toIndex;
but toIndex is positive, i wonder what is going on if a negative number come after the operator(>>>)
any help will be appreciated
If toIndex is positive and a negative (-) sign is placed before it, you have to imagine that the positive binary counterpart of toIndex is converted to it's negative binary counterpart. after that a right shift is then performed. try to manually calculate the result.
after that long litany, just try that line of code and compare to the result of your manual calculation.
if not, then you have to learn to calculate. :)