code: public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
        throws RemoteException {
      // Get the TeamService.
      TeamServiceInterface teamService = adManagerServices.get(session, TeamServiceInterface.class);
  
      // Create a read/write team.
      Team readWriteTeam = new Team();
      readWriteTeam.setName("Read/write team #" + new Random().nextInt(Integer.MAX_VALUE));
      readWriteTeam.setTeamAccessType(TeamAccessType.READ_WRITE);
      readWriteTeam.setHasAllCompanies(false);
      readWriteTeam.setHasAllInventory(false);
  
      // Create a read-only team.
      Team readOnlyTeam = new Team();
      readOnlyTeam.setName("Read-only team #" + new Random().nextInt(Integer.MAX_VALUE));
      readOnlyTeam.setTeamAccessType(TeamAccessType.READ_ONLY);
      readOnlyTeam.setHasAllCompanies(false);
      readOnlyTeam.setHasAllInventory(false);
  
      // Create the teams on the server.
      Team[] teams = teamService.createTeams(new Team[] {readWriteTeam, readOnlyTeam});
  
      for (Team createdTeam : teams) {
        System.out.printf(
            "A team with ID %d and name '%s' was created.%n",
            createdTeam.getId(), createdTeam.getName());
      }
    }
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.