java: working election implementation