How do I write code for Facebook login and logout using Selenium WebDriver

Selenium script for facebook Login and Logout Buttons:
 
 
import java.util.concurrent.TimeUnit;
 
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
 
public class Facebook {
 
/**
* @param args
* @throws InterruptedException 
*/
public static void main(String[] args) throws InterruptedException {
 
// TODO Auto-generated method stub
 
     System.setProperty("webdriver.chrome.driver", "C:\\batch230\\chromedriver.exe");
 
     WebDriver driver= new ChromeDriver();
 
     driver.get("https://www.facebook.com/");
 
     Thread.sleep(5000);
 
     driver.manage().window().maximize();
 
     Thread.sleep(5000);
 
     driver.findElement(By.id("email")).sendKeys("ur email id");
 
     driver.findElement(By.id("pass")).sendKeys("Ur Password");
 
   // click ok Login Button
 
     driver.findElement(By.xpath("//input[@value='Log In']")).click();
 
     
     driver.findElement(By.id("userNavigationLabel")).click();
 
     Thread.sleep(2000);
 
    // click On Log out Button 
 
     driver.findElement(By.xpath("//li[12]/a/span/span")).click();
}
 
}