Objective: Reading binary files and processing binary data

The following files image0, image1, image2 and image3, represent images in a format called Portable Pixel Map (ppm). All files have the following format:
P6
width height
255
A sequence of (3*width*height) number of bytes representing the red, green, and blue intensities (in the range 0 to 255) of each pixel in the image.

Here is a screenshot of the first file that shows the image format in detail.

Your task is to complete this Java program EXACTLY AS DIRECTED in the program, so that the program can function as a PPM Viewer, i.e. can be used to read these files and display the image represented by the data in the file on a JPanel. Note that you have to complete the program exactly as directed. In particular, you MAY NOT use any classes in the Java API, like BufferedImage and others that support image processing, to facilitate this task.

Here are examples illustrating file i/o in Java: Text I/O, Binary I/O.