I have tried 2 naive awk implementations and both took 10x the basic java implementation btw (I'm sure it too can be optimized).