code: public Credential getCredentialFromPrivateKeyServiceAccount(
        String serviceAccountEmail,
        String privateKeyFile,
        List<String> scopes,
        HttpTransport transport)
        throws IOException, GeneralSecurityException {
      logger.atFine().log(
          "getCredentialFromPrivateKeyServiceAccount(%s, %s, %s)",
          serviceAccountEmail, privateKeyFile, scopes);
  
      return new GoogleCredentialWithRetry(
          new GoogleCredential.Builder()
              .setTransport(transport)
              .setJsonFactory(JSON_FACTORY)
              .setServiceAccountId(serviceAccountEmail)
              .setServiceAccountScopes(scopes)
              .setServiceAccountPrivateKeyFromP12File(new File(privateKeyFile))
              .setRequestInitializer(new CredentialHttpRetryInitializer()));
    }
docs: Initializes OAuth2 credential from a private keyfile, as described in <a
  href="https://code.google.com/p/google-api-java-client/wiki/OAuth2#Service_Accounts" > OAuth2
  Service Accounts</a>.
  
  @param serviceAccountEmail Email address of the service account associated with the keyfile.
  @param privateKeyFile Full local path to private keyfile.
  @param scopes List of well-formed desired scopes to use with the credential.
  @param transport The HttpTransport used for authorization