Here you can find the source of downloadFile(URL downloadUrl, File destination)
public static void downloadFile(URL downloadUrl, File destination) throws IOException
//package com.java2s; //License from project: Apache License import java.io.*; import java.net.URL; import java.nio.file.Files; public class Main { public static void downloadFile(URL downloadUrl, File destination) throws IOException { System.out.println("Downloading file from URL: " + downloadUrl + " to destination: " + destination); Files.copy(downloadUrl.openStream(), destination.toPath()); }//from w w w .j a v a 2 s. c om }