Added Java implementation