Added checkstyle

Before every commit, do some static analysis on the code to enforce coding style. Rules have largely been adapted from Google's checkstyle settings.

95% of changes in this PR are

 - Making properties `final` where possible
 - Using diamond type inference where possible
 - Adding `@override` annotations where appropriate
 - Fixing line lengths
 - Fixing whitespace formatting inconsistencies