add Java implementation