Java implementation of voting methods