PreferenceArray sortedPrefs = rawPrefs.clone();
sortedPrefs.sortByValueReversed();
// Cap this at NUM_TOP_PREFERENCES just to be brief
int max = Math.min(NUM_TOP_PREFERENCES, length);
for (int i = 0; i < max; i++) {
Preference pref = sortedPrefs.get(i);
writer.print(pref.getValue());
writer.print('\t');
writer.println(pref.getItemID());
}
writer.println();
writer.println("Recommendations:");
for (RecommendedItem recommendedItem : items) {
writer.print(recommendedItem.getValue());