Here you can find the source of xor(int n1, int n2)
public static int xor(int n1, int n2)
//package com.java2s; //License from project: Open Source License public class Main { public static int xor(int n1, int n2) { return n1 ^ n2; }//from w w w . j av a 2 s . co m public static String xor(String n1, String n2) { if (n1.length() != n2.length()) return null; StringBuilder result = new StringBuilder(); for (int i = 0; i < n1.length(); i++) { int k = n1.charAt(i) ^ n2.charAt(i); result.append((char) k); } return result.toString(); } }