[Demonstration 1]

[Buggy Method]
private void expand() {
    final int newSize = stackVector.length * 2;
    final T[] newArray = (T[]) new Object[newSize];
    for (int i = 0; i < head; i++) newArray[i] = stackVector[i];
    stackVector = newArray;
}

[Buggy Hunk]
for(int i = 0; i < head; i++)

[Patch]
for(int i = 0; i <= head; i++)

[Demonstration 2]

[Buggy Method]
public boolean computeColocalization(Synapse s) {
    if (requireAllColocalized) {
        if (overlapThreshold >= 0) {
            int overlap = s.getClusterOverlap(channels) - overlapThreshold;
            s.setColocalizationScore((double) overlap);
            if (overlap > 0)
                return true;
            else
                return false;
        } else if (distanceThreshold >= 0) {
            double distance = distanceThreshold - s.getMaxClusterDistance(channels);
            s.setColocalizationScore(distance);
            if (distance > 0)
                return true;
            else
                return false;
        }
        System.out.println("Can't test colocalization: Neither overlap nor distance thresholds set.");
        return false;
    }
    double score = 1.0;
    if (overlapThreshold >= 0) {
        for (int i = 0; i < requiredColocalizations.size(); i++) {
            score *= s.getClusterOverlap(requiredColocalizations.elementAt(i)) - overlapThreshold;
        }
    } else if (distanceThreshold >= 0) {
        for (int i = 0; i < requiredColocalizations.size(); i++) {
            score *= distanceThreshold - s.getMaxClusterDistance(requiredColocalizations.elementAt(i));
        }
    } else {
        System.out.println("Can't test colocalization: Neither overlap nor distance thresholds set.");
        return false;
    }
    s.setColocalizationScore(score);
    if (score > 0)
        return true;
    else
        return false;
}

[Buggy Hunk]
int overlap = s.getClusterOverlap(channels) - overlapThreshold;

[Patch]
int overlap = s.getClusterOverlap() - overlapThreshold;

[Demonstration 3]

[Buggy Method]
public String ChapterRange(int start, int finish) {
    String s = new String();
    for (int i = start; i <= finish; i++) {
        s += allArticles.get(i).toString();
    }
    return s;
}

[Buggy Hunk]
s += allArticles.get(i).toString();

[Patch]
s += allChapters.get(i).toString();