java: More nucleotide count, plus grade school

Apparently I forgot to commit the sample nucleotide-count implementation. Added it here, plus a port of grade school.

Part of #933.