[Demonstration 1]

[Buggy Method]
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    //Init Ui Components
    if (savedInstanceState == null) {
        getFragmentManager().beginTransaction().add(R.id.container, new SpectrumFragment()).commit();
    }
    //Create and start AudioRecord Thread
    mAudioRecordThread = new AudioRecordThread(this, mHandler, FFT.ACCURACY_MIDEUM);
    mAudioRecordThread.start();
}

[Buggy Hunk]
mAudioRecordThread = new AudioRecordThread(this, mHandler, FFT.ACCURACY_MIDEUM);

[Patch]
mAudioRecordThread = new AudioRecordThread(this, mHandler, FFT.ACCURACY_HIGH);

[Demonstration 2]

[Buggy Method]
public static void main(String[] args) {
    long start = System.nanoTime();
    int branch = Integer.parseInt(args[0]);
    int depth = Integer.parseInt(args[1]);
    int load = Integer.parseInt(args[2]);
    int nodes = Integer.parseInt(args[3]);
    int executors = Integer.parseInt(args[4]);
    int rank = Integer.parseInt(args[5]);
    ExecutorContext even = new UnitExecutorContext("Even");
    ExecutorContext odd = new UnitExecutorContext("Odd");
    Executor[] e = new Executor[executors];
    for (int i = 0; i < executors; i++) {
        if (rank % 2 == 0) {
            e[i] = new SimpleExecutor(even, StealStrategy.SMALLEST, StealStrategy.BIGGEST);
        } else {
            e[i] = new SimpleExecutor(odd, StealStrategy.SMALLEST, StealStrategy.BIGGEST);
        }
    }
    Constellation c;
    try {
        c = ConstellationFactory.createConstellation(e);
    } catch (ConstellationCreationException e1) {
        logger.error("Could not create constellation", e1);
        return;
    }
    c.activate();
    logger.info("My rank is " + rank);
    if (c.isMaster()) {
        long count = 0;
        for (int i = 0; i <= depth; i++) {
            count += Math.pow(branch, i);
        }
        double time = (load * Math.pow(branch, depth)) / (1000 * (nodes * executors));
        logger.info("Running D&C with even/odd context and branch factor " + branch + " and depth " + depth + " load " + load + " (expected jobs: " + count + ", expected time: " + time + " sec.)");
        SingleEventCollector a = new SingleEventCollector(new UnitActivityContext("Even"));
        c.submit(a);
        c.submit(new DivideAndConquerWithLoadAndContext(new UnitActivityContext("Even", depth), a.identifier(), branch, depth, load));
        long result = (Long) a.waitForEvent().data;
        long end = System.nanoTime();
        double msPerJob = Math.round(((end - start) / 10000.0) * nodes * executors / Math.pow(branch, depth)) / 100.0;
        String correct = (result == count) ? " (CORRECT)" : " (WRONG!)";
        logger.info("D&C(" + branch + ", " + depth + ") = " + result + correct + " total time = " + Math.round((end - start) / 1000000.0) / 1000.0 + " sec; leaf job time = " + msPerJob + " msec/job; overhead = " + Math.round(100 * 100 * (msPerJob - load) / (load)) / 100.0 + "%");
    }
    c.done();
}

[Buggy Hunk]
new UnitActivityContext("Even"));

[Patch]
new UnitActivityContext((rank % 2) == 0 ? "Even" : "Odd"));

[Demonstration 3]

[Buggy Method]
@Override
public String process(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
    FilesystemStatsOverview statsOverview = StatsProviderFactory.getStatsProvider().getFilesystemStatsOverview();
    try {
        //Get statistics from stats overview class
        int usersCount = statsOverview.getUsersCount();
        int projectsCount = statsOverview.getProjectsCount();
        int modelsCount = statsOverview.getModelsCount();
        long diskUsage = Math.round(statsOverview.getDiskUsage() / 1000000);
        //Need to multipy by 1.0 to cast in double ) have a double result
        double averageProjects = projectsCount * 1.0 / usersCount;
        double averageModels = modelsCount * 1.0 / usersCount;
        long averageDiskUsage = Math.round(diskUsage / usersCount);
        //Add statistics to the body
        httpServletRequest.setAttribute("usersCount", usersCount);
        httpServletRequest.setAttribute("projectsCount", projectsCount);
        httpServletRequest.setAttribute("modelsCount", modelsCount);
        httpServletRequest.setAttribute("diskUsage", diskUsage);
        httpServletRequest.setAttribute("averageProjects", averageProjects);
        httpServletRequest.setAttribute("averageModels", averageModels);
        httpServletRequest.setAttribute("averageDiskUsage", averageDiskUsage);
    } catch (IOException | ArithmeticException | ParseException e) {
        e.printStackTrace();
    }
    return "statistics";
}

[Buggy Hunk]
long diskUsage = Math.round(statsOverview.getDiskUsage()/1000000);

[Patch]
long diskUsage = Math.round(statsOverview.getDiskUsage()/ FileUnit.MEGABYTE);