I am using the following code for XOR 2 strings
String lseq = "0011111111101111111111111100101101111100110000001011111000010100"; String tseq = "0011111111100000110011001100110011001100110011001100110011001100"; StringBuilder sb = new StringBuilder(); for(int i = 0; i < lseq.length(); i++) sb.append((lseq.charAt(i) ^ tseq.charAt(i))); String result = sb.toString(); System.out.println(result);
The above code gives me the correct output:
0000000000001111001100110000011110110000000011000111001011011000
I need XOR another line
String hseq = "0011111111110010010111110100010111100000101101001110000100011110";
if I try sb.append((lseq.charAt(i) ^ tseq.charAt(i) ^ hseq.charAt(i));
I get the result:
48484848484848484848484948484948494848494848494949484848494848494848494849494848484949494948484848484948494948494949484948484948
which is wrong. I need help executing xor three binary strings
source share