Java. Convert to use of these new methods where possible. Create unit tests.
Change-Id: Ib21dc7e92eb7324dba79d128d785ced58aaeae2d
Former-commit-id: 0b6b0e06cc [formerly 0b6b0e06cc [formerly 5992197809236553e9c021526e42d28ed327b413]]
Former-commit-id: 40b5d54bf3
Former-commit-id: 8d347252d2