Added license terms and formatted source code.

Apache License added to Mode class.  The algorithm in Mode is probably
inefficient but I find it interesting to calculate mode without using
Java's HashMap. Changed the JavaDoc and formatted some of the code.