code: public static void runExample(
        AdManagerServices adManagerServices,
        AdManagerSession session,
        long advertiserCompanyId,
        long agencyCompanyId)
        throws RemoteException {
      // Get the ContactService.
      ContactServiceInterface contactService =
          adManagerServices.get(session, ContactServiceInterface.class);
  
      // Create an advertiser contact.
      Contact advertiserContact = new Contact();
      advertiserContact.setName("Mr. Advertiser #" + new Random().nextInt(Integer.MAX_VALUE));
      advertiserContact.setEmail("advertiser@advertising.com");
      advertiserContact.setCompanyId(advertiserCompanyId);
  
      // Create an agency contact.
      Contact agencyContact = new Contact();
      agencyContact.setName("Ms. Agency #" + new Random().nextInt(Integer.MAX_VALUE));
      agencyContact.setEmail("agency@agencies.com");
      agencyContact.setCompanyId(agencyCompanyId);
  
      // Create the contacts on the server.
      Contact[] contacts =
          contactService.createContacts(new Contact[] {advertiserContact, agencyContact});
  
      for (Contact createdContact : contacts) {
        System.out.printf(
            "A contact with ID %d and name '%s' was created.%n",
            createdContact.getId(), createdContact.getName());
      }
    }
docs: Runs the example.
  
  @param adManagerServices the services factory.
  @param session the session.
  @param advertiserCompanyId the ID of the advertiser to create a contact for.
  @param agencyCompanyId the ID of the agency to create a contact for.
  @throws ApiException if the API request failed with one or more service errors.
  @throws RemoteException if the API request failed due to other errors.