public void a() throws IOException {
for (int i = 0; i < 9999; i++) {
try {
String format = String.format("%04d", Integer.valueOf(i));
URL url = new URL("https://i.i8tq.com/alarm_icon/" + format + ".png");
URLConnection conn = url.openConnection();
InputStream inputStream = conn.getInputStream();
FileOutputStream fos = new FileOutputStream("d://2//" + format + ".png");
byte[] b = new byte[1024];
int length;
while ((length = inputStream.read(b)) > 0) {
fos.write(b, 0, length);
}
System.out.println("第" + format + "张图片已完成");
} catch (Exception e) {
System.out.println("第" + i + "张图片不存在");
}
}
}