private static void adjustAbs(double[] array,int lower,int upper){
  int j, k;
  double temp;
  j=lower;
  k=lower * 2;
  while (k <= upper) {
    if ((k < upper) && (Math.abs(array[k - 1]) < Math.abs(array[k]))) {
      k+=1;
    }
    if (Math.abs(array[j - 1]) < Math.abs(array[k - 1])) {
      temp=array[j - 1];
      array[j - 1]=array[k - 1];
      array[k - 1]=temp;
    }
    j=k;
    k*=2;
  }
}

private static void adjustAbs ( double [ ] array , int lower , int upper ) { int j , k ; double temp ; j = lower ; k = lower * 2 ; while ( k <= upper ) { if ( ( k < upper ) && ( Math . abs ( array [ k - 1 ] ) < Math . abs ( array [ k ] ) ) ) { k += 1 ; } if ( Math . abs ( array [ j - 1 ] ) < Math . abs ( array [ k - 1 ] ) ) { temp = array [ j - 1 ] ; array [ j - 1 ] = array [ k - 1 ] ; array [ k - 1 ] = temp ; } j = k ; k *= 2 ; } }
helps sort an array of doubles . assumes that array [ lower + 1 ] through to array [ upper ] is already in heap form and then puts array [ lower ] to array [ upper ] in heap form .
