About bit operations in java

  • Question: Why does the first writing method loop to 8 and 9, the result is not the same as expected,

  • If the program treats 11111110 as a decimal number (the binary of 11111110 decimal is ‭101010011000101011000110‬)

  • So how do you explain the results of the previous 7 loops?
    Insert picture description here
    The reason for the output:
    Insert picture description here
    Insert picture description here
    or the following code can also achieve the effect:Insert picture description here

Published 94 original articles · praised 0 · visits 2097

Guess you like

Origin blog.csdn.net/qq_16836791/article/details/104839102