private static void inplacePermute(int[] list,byte[] mthd,Object[] cst,Integer[] indices){
  int x;
  byte xb=0;
  Object xo=null;
  int j, k;
  for (int i=0; i < list.length; i++) {
    x=list[i];
    xb=mthd[i];
    if (cst != null)     xo=cst[i];
    j=i;
    while (true) {
      k=indices[j];
      indices[j]=j;
      if (k == i)       break;
      list[j]=list[k];
      mthd[j]=mthd[k];
      if (cst != null)       cst[j]=cst[k];
      j=k;
    }
    list[j]=x;
    mthd[j]=xb;
    if (cst != null)     cst[j]=xo;
  }
}

private static void inplacePermute ( int [ ] list , byte [ ] mthd , Object [ ] cst , Integer [ ] indices ) { int x ; byte xb = 0 ; Object xo = null ; int j , k ; for ( int i = 0 ; i < list . length ; i ++ ) { x = list [ i ] ; xb = mthd [ i ] ; if ( cst != null ) xo = cst [ i ] ; j = i ; while ( true ) { k = indices [ j ] ; indices [ j ] = j ; if ( k == i ) break ; list [ j ] = list [ k ] ; mthd [ j ] = mthd [ k ] ; if ( cst != null ) cst [ j ] = cst [ k ] ; j = k ; } list [ j ] = x ; mthd [ j ] = xb ; if ( cst != null ) cst [ j ] = xo ; } }
in - place permutation of list , mthd , and cst arrays based on indices , by navigating through cycles in the permutation .
