code: public static <E> Comparator<E> toComparatorDescending(final Counter<E> counter) {
      return new Comparator<E>() {
        public int compare(E o1, E o2) {
          return Double.compare(counter.getCount(o2), counter.getCount(o1));
        }
      };
    }
docs: Returns a comparator backed by this counter: two objects are compared by
  their associated values stored in the counter. This comparator returns keys
  by descending numeric value. Note that this ordering is not fixed, but
  depends on the mutable values stored in the Counter. Doing this comparison
  does not depend on the type of the key, since it uses the numeric value,
  which is always Comparable.
  
  @param counter
  The Counter whose values are used for ordering the keys
  @return A Comparator using this ordering