How to query a list of workflow using Java

Is there any possible way to get a list of workflowId’s which are like “abc%” and terminate or cancel them?