code: protected void swapColumns( int j ) {
  
          // find the column with the largest norm
          int largestIndex = j;
          double largestNorm = normsCol[j];
          for( int col = j+1; col < numCols; col++ ) {
              double n = normsCol[col];
              if( n > largestNorm ) {
                  largestNorm = n;
                  largestIndex = col;
              }
          }
          // swap the columns
          double []tempC = dataQR[j];
          dataQR[j] = dataQR[largestIndex];
          dataQR[largestIndex] = tempC;
          double tempN = normsCol[j];
          normsCol[j] = normsCol[largestIndex];
          normsCol[largestIndex] = tempN;
          int tempP = pivots[j];
          pivots[j] = pivots[largestIndex];
          pivots[largestIndex] = tempP;
      }
docs: Finds the column with the largest normal and makes that the first column
  
  @param j Current column being inspected