[Demonstration 1]

[Buggy Method]
public String toString() {
    String str = "";
    if (nodes.size() > 0) {
        for (short iChar = 0; iChar < nodes.size() - 1; ++iChar) str += nodes.get(iChar) + ",";
        str += nodes.get(nodes.size() - 1);
    }
    return str + ":" + String.valueOf(score) + "--" + String.valueOf(state.ordinal());
}

[Buggy Hunk]
return str + ":" + String.valueOf(score) + "--" + String.valueOf(state.ordinal());

[Patch]
return ":" + str + ":" + String.valueOf(score);

[Demonstration 2]

[Buggy Method]
@Test
public void testPartitionPerf() throws Exception {
    List<PartitionInfo> allPartitions = new ArrayList<PartitionInfo>();
    final int topicCount = 37;
    for (int i = 0; i < topicCount; ++i) {
        final String topici = "topic" + i;
        allPartitions.add(new PartitionInfo(topici, 0, node0, nodes, nodes));
        allPartitions.add(new PartitionInfo(topici, 1, node1, nodes, nodes));
        allPartitions.add(new PartitionInfo(topici, 2, node2, nodes, nodes));
    }
    final Cluster testCluster = new Cluster("clusterId", asList(node0, node1, node2), allPartitions, Collections.<String>emptySet(), Collections.<String>emptySet());
    int threadCount = 10;
    final List<Long> partitionTimeList = Collections.synchronizedList(new ArrayList<Long>(threadCount));
    final CountDownLatch latch = new CountDownLatch(threadCount);
    final int loopCount = 1000000;
    for (int i = 0; i < threadCount; ++i) {
        new Thread(new Runnable() {

            @Override
            public void run() {
                long start = System.currentTimeMillis();
                for (int j = 0; j < loopCount; ++j) {
                    String theTopic = "topic" + j % topicCount;
                    partitioner.partition(theTopic, null, null, null, null, testCluster);
                }
                partitionTimeList.add(System.currentTimeMillis() - start);
                latch.countDown();
            }
        }).start();
    }
    latch.await();
    double sum = 0.0;
    for (int i = 0; i < partitionTimeList.size(); ++i) {
        sum += partitionTimeList.get(i);
    }
    double avg = sum / (double) (loopCount);
    System.out.println("avg partition time(ms)=" + String.format("%5f", avg));
}

[Buggy Hunk]
double avg = sum / (double) (loopCount);

[Patch]
double avg = sum / (double) loopCount;

[Demonstration 3]

[Buggy Method]
@Override
public void run() {
    Canvas c;
    int i = 0;
    while (run) {
        c = null;
        try {
            Thread.sleep(1);
        } catch (InterruptedException e) {
        }
        try {
            c = surfaceHolder.lockCanvas(null);
            synchronized (surfaceHolder) {
                //call methods to draw and process next fame
                render(c, i);
            }
        } finally {
            if (c != null) {
                surfaceHolder.unlockCanvasAndPost(c);
            }
        }
        if (++i >= 5)
            for (Snake snake : snakes) {
                //snake.head().vec=Brains.YuraBot(snake);
                snake.move();
                snake.turn(((new Random()).nextInt(9) - 4) / 4);
                i = 0;
            }
        ;
    }
}

[Buggy Hunk]
if(++i >= 5)

[Patch]
if(++i >= snakeSpeed)