[Demonstration 1]

[Buggy Method]
public void MergeSort(int lowerIndex, int middle, int higherIndex) {
    initializeTemp(lowerIndex, middle, higherIndex);
    int i = lowerIndex;
    int j = middle + 1;
    int k = lowerIndex;
    while (i <= middle && j <= higherIndex) {
        if (temp[i] <= temp[j]) {
            input_nos[k] = temp[i];
            i++;
        } else {
            input_nos[k] = temp[j];
            j++;
        }
        k++;
    }
    while (i <= middle) {
        input_nos[k] = temp[i];
        k++;
        i++;
    }
}

[Buggy Hunk]
initializeTemp(lowerIndex,middle,higherIndex);

[Patch]
initializeTemp(lowerIndex,higherIndex);

[Demonstration 2]

[Buggy Method]
public void sendMsg(Message msg) {
    if (bound) {
        try {
            remoteClient.send(msg);
        } catch (Exception e) {
            Log.e(TAG, "sendMsg error!", e);
        }
    } else {
        Log.d(TAG, "sendMsg not bound");
    }
}

[Buggy Hunk]
if (bound) {

[Patch]
if (bound && remoteClient != null) {

[Demonstration 3]

[Buggy Method]
public static <T> Pair<Integer> minCover(T[] input, Set<T> match) {
    // optimize for case where match is greater than input
    if (match.size() > input.length) {
        return null;
    }
    int i = 0;
    int j = 0;
    int min = -1;
    Pair<Integer> result = null;
    // keeps track of the number of occurrences of each word in match in input[i ... j]
    Map<T, Integer> counts = new HashMap<T, Integer>();
    while (j < input.length) {
        // iterate j until we reach the end or cover all elements
        while (j < input.length && counts.size() < match.size()) {
            T candidate = input[j];
            if (match.contains(candidate)) {
                // found a match; update count
                if (!counts.containsKey(candidate)) {
                    counts.put(candidate, 1);
                } else {
                    counts.put(candidate, counts.get(candidate));
                }
            }
            j++;
        }
        // iterate i while less than end and we cover all elements
        while (i < j && counts.size() == match.size()) {
            T candidate = input[i];
            if (match.contains(candidate)) {
                // decrement count of element at i
                if (counts.get(candidate) == 1) {
                    counts.remove(candidate);
                    // if we will no longer satisfy the cover after this
                    // point, check and see if we need to update the minimum
                    if (min == -1 || j - 1 - i < min) {
                        if (result == null) {
                            // first time we found a valid cover
                            result = new Pair<Integer>(i, j);
                        } else {
                            result.setFirst(i);
                            result.setSecond(j);
                        }
                        min = j - 1 - i;
                    }
                } else {
                    counts.put(candidate, counts.get(candidate) - 1);
                }
            }
            i++;
        }
    }
    return result;
}

[Buggy Hunk]
counts.put(candidate, counts.get(candidate));

[Patch]
counts.put(candidate, counts.get(candidate) + 1);