// Default for total result set size.
int totalResultSetSize = 0;
do {
// Get custom fields by statement.
CustomFieldPage page =
customFieldService.getCustomFieldsByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (CustomField customField : page.getResults()) {
System.out.printf(
"%d) Custom field with ID \"%d\" and name \"%s\" was found.\n", i++,
customField.getId(), customField.getName());
}
}