Get sprints related to a project

I am developing a Jira plugin using Java API, I don,t know how to get all Sprints related to a project.
I managed to get list of all sprints, so I have a Collection<Sprint> and I know the projectID, but I don’t know how to select the sprints which are related to the project with id=projectID.
I want to do something like:

for(Sprint s:Sprints){
        //do something 

Thank you :smiley: