Hi,
in general you can do it using TaskService and TaskQuery, as follows:
List<Task> tasks = taskService.createTaskQuery().
processInstanceId(processInstance.getId()).activityName("activityName").list();
You can use as well orderByDesc or Asc to sort the result.
HTH
Maciej