I have almost straightened out the old code of mine at work so that it will use hashmaps for data lookup instead of the rather idiosyncratic (but working!) system that it was using that I didn't want to port to Java.
It's the almost part of this that's the problem. But that's what debugging is for!