For Selenium Standalone Server perform the following:
profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/java-archive");
and for downloading selenium java webdriver, follow the below statement:
profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/zip");