Cisco Systems Interview Question
Country: India
Interview Type: In-Person
Very simple :
Java code is as follows :
public static void main(String[] args) {
int x = 99;
int y = 24;
int k = x ^ y;
System.out.println(" XOR ::"+k);
System.out.println(" To get 99 :: "+(k^24));
}
It's not possible to get the exact value back. >>> is not a reversible operation. In other words, there are multiple inputs such that applying >>> 2 to them would give you 24. 99, 98, 97, and 96 all yield 24. So if all you know is that you got an answer of 24, you won't be able to determine which of those you started with.
- eugene.yarovoi December 23, 2012