NegativeAdGroupCriterion ageRangeNegativeAdGroupCriterion = new NegativeAdGroupCriterion();
ageRangeNegativeAdGroupCriterion.setAdGroupId(adGroupId);
ageRangeNegativeAdGroupCriterion.setCriterion(ageRangeNegative);
// Create operations.
AdGroupCriterionOperation genderBiddableAdGroupCriterionOperation =
new AdGroupCriterionOperation();
genderBiddableAdGroupCriterionOperation.setOperand(genderBiddableAdGroupCriterion);
genderBiddableAdGroupCriterionOperation.setOperator(Operator.ADD);
AdGroupCriterionOperation ageRangeNegativeAdGroupCriterionOperation =
new AdGroupCriterionOperation();
ageRangeNegativeAdGroupCriterionOperation.setOperand(ageRangeNegativeAdGroupCriterion);
ageRangeNegativeAdGroupCriterionOperation.setOperator(Operator.ADD);
AdGroupCriterionOperation[] operations = new AdGroupCriterionOperation[] {
genderBiddableAdGroupCriterionOperation, ageRangeNegativeAdGroupCriterionOperation};
// Add ad group criteria.