Add tests and supporting Java implementations