1class Solution {2public int[] singleNumber(int[] nums) {3if (nums == null || nums.length < 2 || nums.length % 2 != 0) {4throw new IllegalArgumentException("Invalid Input");5}67int aXORb = 0;8for (int n : nums) {9aXORb ^= n;10}1112int rightSetBit = aXORb & -aXORb;13int a = 0;14for (int n : nums) {15if ((n & rightSetBit) != 0) {16a ^= n;17}18}1920return new int[] {a, aXORb ^ a};21}22}