The code here is provided under the GPL and you are free to use it undert those conditions. Note that the code is not particularly well optimized. It is, however, correct.
The files available:
The preprocessor: preprocesses a CSV file and produces files that are used as input to DBCount_binary.java