Program: 92562
Project: 92562
Buggy source:
@Override public Tree call(){
  int n=x.length;
  int k=smile.math.Math.max(y) + 1;
  int[] samples=new int[n];
  if (subsample == 1.0) {
    for (int l=0; l < k; l++) {
      int nj=0;
      ArrayList<Integer> cj=new ArrayList<>();
      for (int i=0; i < n; i++) {
        if (y[i] == l) {
          cj.add(i);
          nj++;
        }
      }
      nj/=classWeight[l];
      for (int i=0; i < nj; i++) {
        int xi=Math.randomInt(nj);
        samples[cj.get(xi)]+=1;
      }
    }
  }
 else {
    int[] perm=new int[n];
    for (int i=0; i < n; i++) {
      perm[i]=i;
    }
    Math.permutate(perm);
    int[] nc=new int[k];
    for (int i=0; i < n; i++) {
      nc[y[i]]++;
    }
    for (int l=0; l < k; l++) {
      int subj=(int)Math.round(nc[l] * subsample / classWeight[l]);
      int count=0;
      for (int i=0; i < n && count < subj; i++) {
        int xi=perm[i];
        if (y[xi] == l) {
          samples[xi]+=1;
          count++;
        }
      }
    }
  }
  DecisionTree tree=new DecisionTree(attributes,x,y,maxNodes,nodeSize,mtry,rule,samples,order);
  int oob=0;
  int correct=0;
  for (int i=0; i < n; i++) {
    if (samples[i] == 0) {
      oob++;
      int p=tree.predict(x[i]);
      if (p == y[i])       correct++;
synchronized (prediction[i]) {
        prediction[i][p]++;
      }
    }
  }
  double accuracy=1.0;
  if (oob != 0) {
    accuracy=(double)correct / oob;
    logger.info("String_Node_Str",String.format("String_Node_Str",100 * accuracy));
  }
 else {
    logger.error("String_Node_Str");
  }
  return new Tree(tree,accuracy);
}

Fixed version (ground truth):
@Override public Tree call(){
  int n=x.length;
  int k=smile.math.Math.max(y) + 1;
  int[] samples=new int[n];
  if (subsample == 1.0) {
    for (int l=0; l < k; l++) {
      int nj=0;
      ArrayList<Integer> cj=new ArrayList<>();
      for (int i=0; i < n; i++) {
        if (y[i] == l) {
          cj.add(i);
          nj++;
        }
      }
      int size=nj / classWeight[l];
      for (int i=0; i < size; i++) {
        int xi=Math.randomInt(nj);
        samples[cj.get(xi)]+=1;
      }
    }
  }
 else {
    int[] perm=new int[n];
    for (int i=0; i < n; i++) {
      perm[i]=i;
    }
    Math.permutate(perm);
    int[] nc=new int[k];
    for (int i=0; i < n; i++) {
      nc[y[i]]++;
    }
    for (int l=0; l < k; l++) {
      int subj=(int)Math.round(nc[l] * subsample / classWeight[l]);
      int count=0;
      for (int i=0; i < n && count < subj; i++) {
        int xi=perm[i];
        if (y[xi] == l) {
          samples[xi]+=1;
          count++;
        }
      }
    }
  }
  DecisionTree tree=new DecisionTree(attributes,x,y,maxNodes,nodeSize,mtry,rule,samples,order);
  int oob=0;
  int correct=0;
  for (int i=0; i < n; i++) {
    if (samples[i] == 0) {
      oob++;
      int p=tree.predict(x[i]);
      if (p == y[i])       correct++;
synchronized (prediction[i]) {
        prediction[i][p]++;
      }
    }
  }
  double accuracy=1.0;
  if (oob != 0) {
    accuracy=(double)correct / oob;
    logger.info("String_Node_Str",String.format("String_Node_Str",100 * accuracy));
  }
 else {
    logger.error("String_Node_Str");
  }
  return new Tree(tree,accuracy);
}