public static void writeFile(String strUrl, String filePath, String fileName){
try {
URL url = new URL(strUrl);
InputStream is = url.openStream();
File f = new File(filePath);
f.mkdirs();
OutputStream os = new FileOutputStream(filePath + fileName);
int bytesRead = 0;
byte[] buffer = new byte[8192];
while((bytesRead = is.read(buffer,0,8192)) != -1){
os.write(buffer, 0, bytesRead);
}
} catch (Exception e2) {
e2.printStackTrace();
}
}