public int findMissingNum(int[] intArray){
		int bitCount = (int)(Math.log(intArray.length+1)/Math.log(2)); 
		//in case intArray Length is between 2 pow n and 2 pow n+1, should set bitCount to n+1;
		if(Math.pow(2, bitCount) < intArray.length);
		bitCount++;
		
		System.out.println("Bitcount="+bitCount);
		ArrayList<Integer> indexList = new ArrayList<Integer>(); //to save the remaining indexs of elements to inspect	
		int missingNum = 0;
		
		//initially, all elements need to be examined. n elements. 
		for(int i = 0;i<intArray.length;i++){
			indexList.add(new Integer(i));
		}
		
		// i from 0 to top, get ith bit of each element to find out the ith bit
		// for the missing number.
		// remove irrelevant element from the array for each iteration.
		for (int i = 0; i < bitCount; i++) {
			ArrayList<Integer> List0 = new ArrayList<Integer>(); // to save indexs with bit i as 0
			ArrayList<Integer> List1 = new ArrayList<Integer>(); // to save indexs with bit i as 1
			
			for (Integer e : indexList) {
				if (getBit(intArray[e], i) == 0) {
					List0.add(e);
				} else {
					List1.add(e);
				}
			}
			if (List0.size() > List1.size()) { // bit i of missingNum should be 1
				// add the value to missingNum;
				missingNum += Math.pow(2, i);
				
				// remove irrelevant elements from the array;
				indexList = List1;
			} else { // bit i of missingNum should be 0;
				indexList = List0;
			}
		}
		return missingNum;
	}