From the course: Parallel and Concurrent Programming with Java 2

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Challenge: Download images in Java

Challenge: Download images in Java - Java Tutorial

From the course: Parallel and Concurrent Programming with Java 2

Start my 1-month free trial

Challenge: Download images in Java

(electronic music) - [Instructor] For our third and final challenge, your goal will be to design and build a program to concurrently download a collection of image files from the internet and return the total number of bytes. We have 50 images hosted at the URL shown here, which you can use as the target files to download for this challenge. All of the JPG files are numbered sequentially from one to 50. To give you a starting point for this challenge, we've already implemented a sequential version of the image downloader in this example program. The sequential image downloader class has a constructor method on line 14 which takes in an array of integers representing the image numbers to be downloaded. The public download all method on line 19 uses a for loop to iterate through the numbers in that array and passes them, one at a time, to the download image method, which downloads the corresponding image file and then returns the number of bytes it was. The download all method…

Contents