How to get the next users that are pointed out

Hi Team,
How can I get the next users that are pointed .
Lets say from userA I should get user B and from userB I should get Users C,D,E as mentioned in snip


I need java code to get next pointed out user.
Please help me

Thanks in Advance

@sai_vamsi you need to parse the bpmn model to get that result.

https://docs.camunda.org/manual/7.13/user-guide/model-api/bpmn-model-api/read-a-model/

// read a model from a file
File file = new File("PATH/TO/MODEL.bpmn");
BpmnModelInstance modelInstance = Bpmn.readModelFromFile(file);

// read a model from a stream
InputStream stream = [...]
BpmnModelInstance modelInstance = Bpmn.readModelFromStream(stream);

// find all elements of the type task
ModelElementType taskType = modelInstance.getModel().getType(Task.class);
Collection<ModelElementInstance> taskInstances = modelInstance.getModelElementsByType(taskType);