Organized Code and Setup Gradle

I've reviewed your code, the problem solving part is good!
But the code organization, not so much.

My major comments were about the SRP(Single Responsibility Principle)
Use of nulls to convey state - https://code.google.com/p/guava-libraries/wiki/UsingAndAvoidingNullExplained
And the tests were not actually tests, I haven't fixed this.

Instead of just comments on the code, I've sort of rearranged it keeping most of it as is but moving it to separate  logical units.

I've also set up gradle  on this one, this makes it easy for someone to set up the code locally without having to manually dealing with all the jars and the classpath.