Yes, you could use .getServiceAccountCredential
/**
* Constructs credentials for the given account and key.
*
* @param account the account to use.
* @param privateKeyFile the file name from which to get the private key.
* @return valid credentials or {@code null}
*/
public static Credential getServiceAccountCredential(String account, String privateKeyFile) {
...
}