public static void download(URL url, File file) throws IOException {
		if (!file.getParentFile().exists())
			file.getParentFile().mkdir();
		if (file.exists())
			file.delete();
		file.createNewFile();
		int size = url.openConnection().getContentLength();
		Util.info("Downloading " + file.getName() + " (" + size / 1024
				+ "kb) ...");
		InputStream in = url.openStream();
		OutputStream out = new BufferedOutputStream(new FileOutputStream(file));
		byte[] buffer = new byte[1024];
		int len, downloaded = 0, msgs = 0;
		final long start = System.currentTimeMillis();
		while ((len = in.read(buffer)) >= 0) {
			out.write(buffer, 0, len);
			downloaded += len;
			if ((int) ((System.currentTimeMillis() - start) / 500) > msgs) {
				Util.info((int) ((double) downloaded / (double) size * 100d)
						+ "%");
				msgs++;
			}
		}
		in.close();
		out.close();
		Util.info("Download finished");
	}