code: public boolean previous()
  	{
  		if( indexes.length <= 1 || permutation <= 0 )
  			return false;
  
  		int N = indexes.length-2;
  		int k = N;
  
  		while( counters[k] <= k ) {
  			k--;
  		}
  
  		swap(counters[k], k);
  		counters[k]--;
  		swap(k, counters[k]);
  		int foo = k+1;
  		while( counters[k+1] == k+1 && k < indexes.length-2) {
  			k++;
  			swap(k, indexes.length-1);
  		}
  
  		for (int i = foo; i < indexes.length - 1; i++) {
  			counters[i] = indexes.length - 1;
  		}
  
  		permutation--;
  		return true;
  	}
docs: This will undo a permutation.