code: public boolean next()
  	{
  		if( indexes.length <= 1 || permutation >= total-1 )
  			return false;
  
  		int N = indexes.length-2;
  		int k = N;
  
  		swap(k, counters[k]++);
  		while( counters[k] == indexes.length ) {
  			k -= 1;
  			swap(k, counters[k]++);
  		}
  		swap(counters[k], k);  //before
  		while (k < indexes.length - 1) {
  			k++;
  			counters[k] = k;
  		}
  
  		permutation++;
  		return true;
  	}
docs: This will permute the list once