public int singleNumber(int[] A) {
        if (A == null || A.length == 0) {
            return 0;
        }

        int[] record = new int[32];

        for (int i = 0; i < A.length; i++) {
            for (int j = 0; j < record.length; j++) {
                int cur = A[i] >> j;

                if (cur == 0) {
                    break;
                }

                record[j] += (cur & 1);
            }
        }

        int k = 0;

        for (int j = 0; j < record.length; j++) {
            int c = record[j] % 3;
            if (c != 0) {
                k |= (c << j);
            }
        }
        return k;


    }