code: public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
        throws RemoteException {
      // Get the CompanyService.
      CompanyServiceInterface companyService =
          adManagerServices.get(session, CompanyServiceInterface.class);
  
      // Create an advertiser.
      Company advertiser = new Company();
      advertiser.setName("Advertiser #" + new Random().nextInt(Integer.MAX_VALUE));
      advertiser.setType(CompanyType.ADVERTISER);
  
      // Create an agency.
      Company agency = new Company();
      agency.setName("Agency #" + new Random().nextInt(Integer.MAX_VALUE));
      agency.setType(CompanyType.AGENCY);
  
      // Create the companies on the server.
      Company[] companies = companyService.createCompanies(new Company[] {advertiser, agency});
  
      for (Company createdCompany : companies) {
        System.out.printf(
            "A company with ID %d, name '%s', and type '%s' was created.%n",
            createdCompany.getId(), createdCompany.getName(), createdCompany.getType());
      }
    }
docs: Runs the example.
  
  @param adManagerServices the services factory.
  @param session the session.
  @throws ApiException if the API request failed with one or more service errors.
  @throws RemoteException if the API request failed due to other errors.