code: public void pairsSortedByValue(final IntArrayList keyList, final IntArrayList valueList) {
  	keys(keyList);
  	values(valueList);
  	
  	final int[] k = keyList.elements();
  	final int[] v = valueList.elements();
  	cern.colt.Swapper swapper = new cern.colt.Swapper() {
  		public void swap(int a, int b) {
  			int t2;	int t1;
  			t1 = v[a]; v[a] = v[b]; v[b] = t1;
  			t2 = k[a]; k[a] = k[b];	k[b] = t2;
  		}
  	}; 
  
  	cern.colt.function.IntComparator comp = new cern.colt.function.IntComparator() {
  		public int compare(int a, int b) {
  			return v[a]<v[b] ? -1 : v[a]>v[b] ? 1 : (k[a]<k[b] ? -1 : (k[a]==k[b] ? 0 : 1));
  		}
  	};
  
  	cern.colt.GenericSorting.quickSort(0,keyList.size(),comp,swapper);
  }
docs: Fills all keys and values <i>sorted ascending by value</i> into the specified lists.
  Fills into the lists, starting at index 0.
  After this call returns the specified lists both have a new size that equals <tt>this.size()</tt>.
  Primary sort criterium is "value", secondary sort criterium is "key".
  This means that if any two values are equal, the smaller key comes first.
  <p>
  <b>Example:</b>
  <br>
  <tt>keys = (8,7,6), values = (1,2,2) --> keyList = (8,6,7), valueList = (1,2,2)</tt>
  
  @param keyList the list to be filled with keys, can have any size.
  @param valueList the list to be filled with values, can have any size.