Here you can find the source of download(String url, String path)
public static void download(String url, String path)
//package com.java2s; //License from project: Open Source License import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.net.URL; public class Main { public static void download(String url, String path) { InputStream is = null;/* w w w . jav a2 s . co m*/ OutputStream os = null; try { is = new URL(url).openStream(); byte[] bs = new byte[1024]; int len; os = new FileOutputStream(path); while ((len = is.read(bs)) != -1) { os.write(bs, 0, len); } } catch (Exception e) { e.printStackTrace(); } finally { try { is.close(); os.close(); } catch (Exception e2) { e2.printStackTrace(); } } } }