code: public static int[][] sort(Attribute[] attributes, double[][] x) {
          int n = x.length;
          int p = x[0].length;
          
          double[] a = new double[n];
          int[][] index = new int[p][];
          
          for (int j = 0; j < p; j++) {
              if (attributes[j].getType() == Attribute.Type.NUMERIC) {
                  for (int i = 0; i < n; i++) {
                      a[i] = x[i][j];
                  }
                  index[j] = QuickSort.sort(a);
              }
          }
          
          return index;        
      }
docs: Sorts each variable and returns the index of values in ascending order.
  Only numeric attributes will be sorted. Note that the order of original
  array is NOT altered.
  
  @param x a set of variables to be sorted. Each row is an instance. Each
  column is a variable.
  @return the index of values in ascending order