I made your code readable. Please do that from now on.
Your flow is as follows...
- if span[1] is not selected then
- click span[1]
- else if span[2] is not selected then
- click span[2]
Please clarify what precisely is happening so we can help you properly.
EDIT
As I mention above your second part is checking if span[2] is not selected...
- If Element 1 is not selected
- Click it
- Else Click Element 2
Here is how you can follow your logic
if (!driver.findElement(By.xpath("/html/body/div[1]/div[2]/div[4]/div[1]/div/div/div[2]/div/div[1]/div[1]/div[2]/div[2]/span/span[1]")).isSelected() ) {
driver.findElement(By.xpath("/html/body/div[1]/div[2]/div[4]/div[1]/div/div/div[2]/div/div[1]/div[1]/div[2]/div[2]/span/span[1]")).click();
} else {
driver.findElement(By.xpath("/html/body/div[1]/div[2]/div[4]/div[1]/div/div/div[2]/div/div[1]/div[1]/div[2]/div[2]/span/span[2]")).click();
}