Multiple choice java

Which one of the following operators offers the fastest way to divide a negative integer by 2 and keep the negative result (e.g., -4/2 equals -2)?

  1. /

  2. %

  3. >>

  4. >>>

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The '>>' operator is the signed right-shift operator. Shifting an integer right by 1 bit is equivalent to dividing by 2 while preserving the sign bit. For negative numbers, it uses sign extension, ensuring -4 (1111...1100) shifted right becomes -2 (1111...1110). '>>>' is unsigned and would fail.