How to get data for printReplicationInfo() using java

I want to get the output of printReplicationInfo or getReplicationInfo using Java but I could not get can any one help me out.I am using mongo reactive streams 4.8.2 driver.

**make sure you have admin rights for the user.
the below snippet will provide you the required data

DB db = mongoClient.getDatabase("admin");
Document documentA = db.runCommand(new Document("getReplicationInfo",1));