// Default for total result set size.
int totalResultSetSize = 0;
do {
// Get audience segments by statement.
AudienceSegmentPage page =
audienceSegmentService.getAudienceSegmentsByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (AudienceSegment audienceSegment : page.getResults()) {
System.out.printf(
"%d) Audience segment with ID \"%d\" and name \"%s\" of size " +
"\"%d\" was found.\n", i++,
audienceSegment.getId(),
audienceSegment.getName(),