-To understand this concept, you should refresh your knowledge about converting from Decimal to Binary.
-video to explain the converting: https://youtu.be/Bs8qdYiRXcc
-To deepen into the mathematical and Algebra that happened behind the scenes during the conversion watch this video: https://youtu.be/H4BstqvgBow
-To have an overview of the Bitwise operators in Java, watch this video: https://youtu.be/qfH2Fkc1ujg
-To make sure you understand the XOR operator: try to solve this problem on Leet Code: Single Number - LeetCode
Give it a try first and then see my solution.
class Solution {
public int singleNumber(int[] nums) {
int unique=0;
for(int i=0;i<nums.length;i++){
unique^=nums[i];
}
return unique;
}
}