I've seen several high-voted bit-counter solutions, but they were all quite long.

**C++** (Java would be almost the same)

```
int majorityElement(vector<int>& nums) {
int winner = 0;
for (int i=0; i<32; i++) {
int ones = 0;
for (int n : nums)
ones += (n >> i) & 1;
winner += (ones > nums.size() / 2) << i;
}
return winner;
}
```

**Python**

For once, Python's arbitrarily large integers are a disadvantage :-(

```
def majorityElement(self, nums):
return (sum((sum(n>>i&1 for n in nums) > len(nums)/2) << i
for i in range(32)) + 2**31) % 2**32 - 2**31
```