Hi @sagaraa
You can try this rough and ready code:
final List<FlowElement> userTasks = repositoryService.getBpmnModel(<your_process_id>)
.getMainProcess()
.getFlowElements()
.stream()
.filter(UserTask.class::isInstance)
.collect(Collectors.toList());
It finds user tasks inside main process.