code: public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
        throws RemoteException {
      // Get the LabelService.
      LabelServiceInterface labelService =
          adManagerServices.get(session, LabelServiceInterface.class);
  
      // Create a competitive exclusion label.
      Label competitiveExclusionLabel = new Label();
      competitiveExclusionLabel.setName(
          "Car company label #" + new Random().nextInt(Integer.MAX_VALUE));
      competitiveExclusionLabel.setTypes(new LabelType[] {LabelType.COMPETITIVE_EXCLUSION});
  
      // Create an ad unit frequency cap label.
      Label adUnitFrequencyCapLabel = new Label();
      adUnitFrequencyCapLabel.setName(
          "Don't run too often label #" + new Random().nextInt(Integer.MAX_VALUE));
      adUnitFrequencyCapLabel.setTypes(new LabelType[] {LabelType.AD_UNIT_FREQUENCY_CAP});
  
      // Create the labels on the server.
      Label[] labels =
          labelService.createLabels(new Label[] {competitiveExclusionLabel, adUnitFrequencyCapLabel});
  
      for (Label createdLabel : labels) {
        System.out.printf("A label with ID %d and name '%s' was created.%n",
            createdLabel.getId(), createdLabel.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.