add two java implementations