Implemented to/as representation conversion in Java API. Closes #4.