The following code is a simple program for recognizing file types. What's interesting about it is that it is extensible. You can basically make "plug-ins" to add more and more file types that it recognizes. The basic program is:

However, HW11 makes use of a second "recognizer" that recognizers JPG files. It just extends the basic RecogASCII and modifies its functionality a bit:

Take your favorite jpg file or ascii file (suppose it is called "foo") and run the analyzer like this:
cat foo | java HW11
... and if it's an ASCII file or JPG, the program will identify that fact.