title: Xor of binary strings in java
body: <p>i am using the following code to XOR 2 strings </p>
  
  <pre><code>String lseq = "0011111111101111111111111100101101111100110000001011111000010100";
  String tseq = "0011111111100000110011001100110011001100110011001100110011001100";
  
  StringBuilder sb = new StringBuilder();
  
  for(int i = 0; i &lt; lseq.length(); i++)
      sb.append((lseq.charAt(i) ^ tseq.charAt(i)));
  
  String result = sb.toString();
  System.out.println(result);
  </code></pre>
  
  <p>The above code gives me correct output :</p>
  
  <pre><code>0000000000001111001100110000011110110000000011000111001011011000
  </code></pre>
  
  <p>I need to XOR one more string </p>
  
  <pre><code>String hseq = "0011111111110010010111110100010111100000101101001110000100011110";
  </code></pre>
  
  <p>if i try <code>sb.append((lseq.charAt(i) ^ tseq.charAt(i) ^ hseq.charAt(i));</code></p>
  
  <p>I am getting result :</p>
  
  <pre><code>48484848484848484848484948484948494848494848494949484848494848494848494849494848484949494948484848484948494948494949484948484948
  </code></pre>
  
  <p>which is wrong. I need help in doing xor of 3 binary strings </p>