public static void main(String[] args) {
String urls = "http://rongcloud-web.qiniudn.com/docs_demo_rongcloud_logo.png";
String path = "d:/pic.png";
try {
URL url = new URL(urls);
DataInputStream dataInputStream = new DataInputStream(url.openStream());
FileOutputStream fileOutputStream = new FileOutputStream(new File(path));
ByteArrayOutputStream output = new ByteArrayOutputStream();

byte[] buffer = new byte[1024];
int length;

while ((length = dataInputStream.read(buffer)) > 0) {
output.write(buffer, 0, length);
}
fileOutputStream.write(output.toByteArray());
dataInputStream.close();
fileOutputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}