// Set the creative rotation type to optimized.
lineItem.setCreativeRotationType(CreativeRotationType.OPTIMIZED);
// Create the master creative placeholder.
CreativePlaceholder creativeMasterPlaceholder = new CreativePlaceholder();
creativeMasterPlaceholder.setSize(new Size(400, 300, false));
// Create companion creative placeholders.
CreativePlaceholder companionCreativePlaceholder1 = new CreativePlaceholder();
companionCreativePlaceholder1.setSize(new Size(300, 250, false));
CreativePlaceholder companionCreativePlaceholder2 = new CreativePlaceholder();
companionCreativePlaceholder2.setSize(new Size(728, 90, false));
// Set companion creative placeholders.
creativeMasterPlaceholder.setCompanions(new CreativePlaceholder[] {
companionCreativePlaceholder1, companionCreativePlaceholder2});