add java and kotlin implementations