code: public Bigquery getBigQueryFromCredential(Credential credential, String appName) {
      logger.atInfo().log("Creating BigQuery from given credential.");
      // Use the credential to create an authorized BigQuery client
      if (credential != null) {
        return new Bigquery
            .Builder(HTTP_TRANSPORT, JSON_FACTORY, new RetryHttpInitializer(credential, appName))
            .setApplicationName(appName).build();
      }
      return new Bigquery.Builder(HTTP_TRANSPORT, JSON_FACTORY, null)
          .setApplicationName(appName).build();
    }
docs: Constructs a BigQuery from a given Credential.