How to CAPTURE and VISIT all the links on a web page using selenium webdriver ?

driver.get("http://seleniumsubbu.blogspot.in//");
List<WebElement> all_links_webpage = driver.findElements(By.tagName("a"));
System.out.println("Print total no of links");
linksCount = all_links_webpage.size();
System.out.println(linksCount);
links= new String[linksCount];
System.out.println("Print Links");
for(int i=0;i<linksCount;i++)
{
links[i] = all_links_webpage.get(i).getAttribute("href");
System.out.println(all_links_webpage.get(i).getAttribute("href"));
}
homeWindow = driver.getWindowHandle().toString();
System.out.println("Visiting Each Link");
for(int i=0;i<linksCount;i++)
{
driver.navigate().to(links[i]);
Thread.sleep(3000);
driver.switchTo().window(homeWindow);
}