When I use the Unsigned Right Shift (Logical Shift) operator in java, I get the same result as the normal right-shift operator would give. my code is:
byte b1 = -99; // 01100011
byte result = (byte) (b1 >>> 6);
String str = String.format("%8s", Integer.toBinaryString(result & 0xFF)).replace(' ', '0');
System.out.println("result: " + result);
The preceding code produces the same output which is -13 with both of >> and >>> operators, what is the reason behind that and how to resolve it?