Please check my java code
The problem with the code is, that string that are created are in the following manner:
String representation
1 : 1
2 : 10
so the position where the bits are added are wrong.
You need to adjust the code in a way that the same position values are added
1: 01
2: 10
need to be added.
In case u are not able to code, to reply i`ll help u out