question: final void report ( CounterNameFunction f ) { double sum = 0 ; Vector < Counter > vec = new Vector < Counter > ( ) ; for ( int i = 0 ; i < getNumCounters ( ) ; i ++ ) { double count = getCounter ( i ) ; if ( count > 0.0 ) { sum += count ; String s = f . getName ( i ) ; vec . add ( new Counter ( s , count ) ) ; } } sort ( vec ) ; for ( Enumeration < Counter > e = vec . elements ( ) ; e . hasMoreElements ( ) ; ) { Counter c = e . nextElement ( ) ; String s = c . name ; double count = c . count ; double percent = ( 100 * count ) / sum ; VM . sysWrite ( count + "/" + sum + " = " + percent + "% " + s + "\n" ) ; } }
target:  This method prints the (sorted) nonzero elements a counter array.