*/
  private void createSubsample() throws Exception {    int origSize = getInputFormat().numInstances();    int sampleSize = (int) (origSize * m_SampleSizePercent / 100);    if ((getInputFormat().classIndex() == -1)         || !(getInputFormat().classAttribute().isNominal())) {      // Simple subsample      Random random = new Random(m_RandomSeed);      // Convert pending input instances      for(int i = 0; i < sampleSize; i++) {        int index = (int) (random.nextDouble() * origSize);        push((Instance)getInputFormat().instance(index).copy());      }    } else {      // Subsample that takes class distribution into consideration      // Sort according to class attribute.      getInputFormat().sort(getInputFormat().classIndex());            // Create an index of where each class value starts      int [] classIndices = new int [getInputFormat().numClasses() + 1];      int currentClass = 0;      classIndices[currentClass] = 0;      for (int i = 0; i < getInputFormat().numInstances(); i++) {        Instance current = getInputFormat().instance(i);        if (current.classIsMissing()) {          for (int j = currentClass + 1; j < classIndices.length; j++) {            classIndices[j] = i;          }          break;        } else if (current.classValue() != currentClass) {          for (int j = currentClass + 1; j <= current.classValue(); j++) {            classIndices[j] = i;          }                    currentClass = (int) current.classValue();        }      }      if (currentClass <= getInputFormat().numClasses()) {        for (int j = currentClass + 1; j < classIndices.length; j++) {          classIndices[j] = getInputFormat().numInstances();        }      }      for (int i = 0; i < classIndices.length; i++) {        System.err.println("C[" + i + "] = " + classIndices[i]);      }      int actualClasses = 0;      for (int i = 0; i < classIndices.length - 1; i++) {        if (classIndices[i] != classIndices[i + 1]) {          actualClasses++;        }      }      // Create the new sample      Random random = new Random(m_RandomSeed);      // Convert pending input instances      for(int i = 0; i < sampleSize; i++) {        int index = 0;        if (random.nextDouble() < m_BiasToUniformClass) {          // Pick a random class (of those classes that actually appear)	  int cIndex = Math.abs(random.nextInt()) % actualClasses;          for (int j = 0, k = 0; j < classIndices.length - 1; j++) {            if ((classIndices[j] != classIndices[j + 1])                 && (k++ >= cIndex)) {              // Pick a random instance of the designated class              index = classIndices[j] 		+ (Math.abs(random.nextInt()) % (classIndices[j + 1]						 - classIndices[j]));              break;            }          }        } else {          index = (int) (random.nextDouble() * origSize);        }        push((Instance)getInputFormat().instance(index).copy());      }    }  }