Hi,
Please UseCodeTags and proper indentation when posting code. And, why on earth would you have a System.exit(0) in the reduce() method? Doesn't make any sense to me.
I've edited the post for you to add code tags. See UseCodeTags for how to do this yourself.
Other than that, if you want anyone to be able to help you, you really need to explain what you mean by "not working". See ItDoesntWorkIsUseless for more details.