// Loop through the <item> elements, discovering which threshold
// the item belongs to, then using the element's <title> value
// in in a sorted list.
for (int j = 0; j < itemElements.length; j++)
{
ItemType item = itemElements[j];
// For each <item> element, find out the int value of its <price>
// parent element's threshold attribute value. Append the item's
// title to the appropriate string buffer.
switch (priceElements[i].getThreshold().intValue())
{
case PriceType.Threshold.INT_BELOW_10_DOLLARS:
zeroBuffer.append(" " + item.getTitle() + "\n");
break;
case PriceType.Threshold.INT_BETWEEN_10_AND_20_DOLLARS:
tenBuffer.append(" " + item.getTitle() + "\n");
break;
case PriceType.Threshold.INT_ABOVE_20_DOLLARS:
twentyBuffer.append(" " + item.getTitle() + "\n");
break;
default:
System.out.println("Yo! Something unexpected happened!");
break;