```
public int singleNumber(int[] nums) {
int result = 0;
int bit = 0;
for (int i = 0; i < 32; i++) {
bit = 0;
for (int n : nums)
bit = bit + ((n >> i) & 1);
result = result << 1;
result += bit % 3;
}
return reverseBits(result);
}
public int reverseBits(int n) {
if (n == 0)
return 0;
int result = 0;
for (int i = 0; i < 32; i++) {
result = result << 1;
if ((n & 1) == 1)
result++;
n = n >> 1;
}
return result;
}
```