// Get the CompanyService.
CompanyServiceInterface companyService =
dfpServices.get(session, CompanyServiceInterface.class);
// Create an advertiser.
Company company1 = new Company();
company1.setName("Advertiser #" + new Random().nextLong());
company1.setType(CompanyType.ADVERTISER);
// Create an agency.
Company company2 = new Company();
company2.setName("Agency #" + new Random().nextLong());
company2.setType(CompanyType.AGENCY);
// Create the companies on the server.
Company[] companies = companyService.createCompanies(new Company[] {company1, company2});
for (Company company : companies) {