When it comes to debugging code, the person who coded up the program has a the best chance of catching the mistake, as only they know everything that is going on in their code. Having said that, the error would have occurred anywhere. Try debugging it yourself (since you already know what testcase it is failing, try looking at all the intermediate steps). I can`t run it for you at home and figure out what it is doing as I don`t have a Java compiler, nor do I have the time (sorry).