Java code to select from dropdown

public String selectFromDropDown(WebDriver driver, WebDriverWait wait, int index, String id_str)
{
Select dropDown = new Select(driver.findElement(By.id(id_str)));
dropDown.selectByIndex(index);
return dropDown.getAllSelectedOptions().get(0).getText();
}

Web element