Find out the ONE number which appear odd number of times in array

You are given an integer array, where all numbers except for ONE numbers appear even number of times.

Q: Find out the ONE number which appear odd number of times.

This is very simple using bitwise which is going to use only O(1) space.

Input : int a[] = { 4, 2, 6, 3, 4, 5, 6, 5, 2 };
Output : Number is : 3

public class BitwiseFindOneOddNumber {

	public static void main(String[] args) {

		int a[] = { 4, 2, 6, 3, 4, 5, 6, 5, 2 };

		System.out.println(" Number is : " + oddNumberIs(a));

	}

	public static int oddNumberIs(int a[]) {

		int xor = a[0];

		for (int i = 1; i < a.length; i++) {
			xor ^= a[i];
		}

		return xor;

	}

}