0

0xc2000000 = 1100 0010 0000 0000 0000 0000 0000 0000.

So 0xc2000000 >> 24 should be 1000 0000 0000 0000 0000 0000 1100 0010,right?

But the result is -62 which is 1000 0000 0000 0000 0000 0000 0011 1110.

I'm so confused

General Grievance
  • 4,555
  • 31
  • 31
  • 45
dissdic
  • 11
  • 1
  • 3
    Have you used `Integer.toBinaryString(int)` to verify what the binary numbers actually are? – Kayaman Jun 29 '21 at 16:18
  • If you want the result to be `0xC2` aka `194`, then you need to use `>>>`, so it doesn't do sign-extension. – Andreas Jun 29 '21 at 16:44

0 Answers0