I’m curious why you need to do this, if you let us know what you need to do with the info we may we able to suggest other approaches.
This (untested, admittedly) Java SDK code should access that data:
DocumentFragment<Lookup> result = bucket.lookupIn("doc-id")
.get("_sync.rev", SubdocOptionsBuilder.builder().xattr(true))
.execute();
String content = (String) result.content(0);