Seperated conditions to help understand quickly.

```
public class Solution {
public int singleNonDuplicate(int[] nums) {
int low =0;
int high = nums.length -1;
int mid;
boolean left;
boolean leftFirst;
boolean leftSecond;
while(low<high)
{
mid = low + (high-low)/2;
if(nums[mid]!=nums[mid-1] && nums[mid]!=nums[mid+1])
return nums[mid];
//conditions to be true if an element is in left side
leftFirst = (nums[mid] == nums[mid-1]) && (mid)%2==0; //if its the second occurence of that element
leftSecond = (nums[mid] == nums[mid+1]) && (mid)%2==1; //if its the first occurence of that element
left = leftFirst||leftSecond; //if any of the above conditions are true, We will go left
if(left)
high = mid-1;
else
low = mid+1;
}
return nums[low];
}
}
```