[Demonstration 1]

[Buggy Method]
public List<Recognition> recognizeImage(final Bitmap bitmap) {
    // Log this method so that it can be analyzed with systrace.
    Trace.beginSection("recognizeImage");
    Trace.beginSection("preprocessBitmap");
    // Preprocess the image data from 0-255 int to normalized float based
    // on the provided parameters.
    bitmap.getPixels(intValues, 0, bitmap.getWidth(), 0, 0, bitmap.getWidth(), bitmap.getHeight());
    for (int i = 0; i < intValues.length; ++i) {
        final int val = intValues[i];
        floatValues[i * 3 + 0] = (((val >> 16) & 0xFF) - imageMean) / imageStd;
        floatValues[i * 3 + 1] = (((val >> 8) & 0xFF) - imageMean) / imageStd;
        floatValues[i * 3 + 2] = ((val & 0xFF) - imageMean) / imageStd;
    }
    Trace.endSection();
    // Copy the input data into TensorFlow.
    Trace.beginSection("feed");
    inferenceInterface.feed(inputName, floatValues, 1, inputSize, inputSize, 3);
    Trace.endSection();
    // Run the inference call.
    Trace.beginSection("run");
    inferenceInterface.run(outputNames);
    Trace.endSection();
    // Copy the output Tensor back into the output array.
    Trace.beginSection("fetch");
    inferenceInterface.fetch(outputName, outputs);
    Trace.endSection();
    // Find the best classifications.
    PriorityQueue<Recognition> pq = new PriorityQueue<>(3, new Comparator<Recognition>() {

        @Override
        public int compare(Recognition lhs, Recognition rhs) {
            // Intentionally reversed to put high confidence at the head of the queue.
            return Float.compare(rhs.getConfidence(), lhs.getConfidence());
        }
    });
    for (int i = 0; i < outputs.length; ++i) {
        if (outputs[i] > THRESHOLD) {
            pq.add(new Recognition("" + i, labels.size() > i ? labels.get(i) : "unknown", outputs[i], null));
        }
    }
    final ArrayList<Recognition> recognitions = new ArrayList<>();
    int recognitionsSize = Math.min(pq.size(), MAX_RESULTS);
    for (int i = 0; i < recognitionsSize; ++i) {
        recognitions.add(pq.poll());
    }
    // "recognizeImage"
    Trace.endSection();
    return recognitions;
}

[Buggy Hunk]
"" + i, labels.size() > i ? labels.get(i) : "unknown", outputs[i], null));

[Patch]
Integer.toString(i), labels.size() > i ? labels.get(i) : "unknown", outputs[i], null));

[Demonstration 2]

[Buggy Method]
@Test(timeout = 5000)
public void testCreateTemporaryTopicFailsWhenLinkRefusedAndAttachResponseWriteIsNotDeferred() throws Exception {
    doCreateTemporaryDestinationFailsWhenLinkRefusedTestImpl(false, false);
}

[Buggy Hunk]
doCreateTemporaryDestinationFailsWhenLinkRefusedTestImpl(false, false);

[Patch]
doCreateTemporaryDestinationFailsWhenLinkRefusedTestImpl(true, false);

[Demonstration 3]

[Buggy Method]
public LineGraphSeries<DataPoint> workOutResults(ArrayList<Integer> sessions) {
    LineGraphSeries<DataPoint> series = null;
    DataPoint[] dataPoint = new DataPoint[sessions.size()];
    if (sessions.size() == 0) {
        // textView.setText("There is no data within these parameters.");
    } else {
        //  textView.setText("");
        //
        float start = 0;
        for (int i = 0; i < sessions.size(); i++) {
            start = (float) sessions.get(i);
            dataPoint[i] = new DataPoint(i, start);
        }
        series = new LineGraphSeries<>(dataPoint);
    }
    return series;
}

[Buggy Hunk]
for (int i = 0; i < sessions.size(); i++) {

[Patch]
for (int i = sessions.size()-1; i >= 0; i=i-1) {