// Get DfpUser from "~/dfp.properties".
DfpUser user = new DfpUser();
// Get the CreativeSetService.
CreativeSetServiceInterface creativeSetService =
user.getService(DfpService.V201211.CREATIVE_SET_SERVICE);
// Set the ID of the creatives to associate with this set.
Long masterCreativeId = Long.parseLong("INSERT_MASTER_CREATIVE_ID_HERE");
Long companionCreativeId = Long.parseLong("INSERT_COMPANION_CREATIVE_ID_HERE");
CreativeSet creativeSet = new CreativeSet();
creativeSet.setName("Creative set #" + new Random().nextLong());
creativeSet.setMasterCreativeId(masterCreativeId);
creativeSet.setCompanionCreativeIds(new long[] {companionCreativeId});
// Create the creative set on the server.
creativeSet = creativeSetService.createCreativeSet(creativeSet);
if (creativeSet != null) {
System.out.println("A creative set with ID \"" + creativeSet.getId()
+ "\", master creative ID \"" + creativeSet.getMasterCreativeId()
+ "\", and companion creative IDs {"