I am now trying to do the same except I am automating the environment, cluster, accounts with Terraform.
I managed to create the environment, the cluster and a service account. But not sure how to create the credentials to be able to run my Java test harness again.
The Confluent Terraform Provider has a great set of example configurations, and hopefully you will find what you need in there in terms of creating API keys for service accounts.
For example, this block creates an API key for the app-consumer Service Account.
created a service account, role binding and API Key. Then output the results on the command line
terraform show -json terraform.tfstate > output.json
from which I extract the API Key id and secret. Need find a way eventually to pass this through code if I were to run this in a CICD tool. But for now this does the trick.