Improve code examples for Java and Python
Bug: T207749 Change-Id: Ia9a4a4062e1c2b929d9f90564cc38b29f58c01e6