finished product without javadoc.  now runs efficiently and produces the correct answer.  Includes JUnit tests.