[Demonstration 1]

[Buggy Method]
@Override
public int compare(Player player, Player t1) {
    if ((player.wins + player.losses) > (t1.wins + t1.losses))
        return 1;
    else
        return -1;
}

[Buggy Hunk]
if ((player.wins + player.losses) > (t1.wins + t1.losses)) return 1;

[Patch]
if ((player.wins + player.losses) < (t1.wins + t1.losses)) return 1;

[Demonstration 2]

[Buggy Method]
protected ArrayList<RobotParticle> resampleParticles(ArrayList<Double> measurementProbs) {
    ArrayList<RobotParticle> resampledParticles = new ArrayList<RobotParticle>();
    int index = (int) (Math.random() * numParticles);
    double beta = 0.0;
    double maxProb = Collections.max(measurementProbs);
    for (int i = 0; i < numParticles; i++) {
        beta += (Math.random() * 2 * maxProb);
        while (measurementProbs.get(index) < beta) {
            beta -= measurementProbs.get(index);
            index += 1;
            index += numParticles;
            index %= numParticles;
        }
        System.out.println("Index chosen: " + index);
        resampledParticles.add(particles.get(index));
    }
    return resampledParticles;
}

[Buggy Hunk]
resampledParticles.add(particles.get(index));

[Patch]
resampledParticles.add(new RobotParticle(particles.get(index)));

[Demonstration 3]

[Buggy Method]
protected void addField(XContentBuilder xContentBuilder, Field field) throws IOException {
    String name = field.getName();
    if (!field.isLocalized()) {
        String[] values = field.getValues();
        if (ArrayUtil.isEmpty(values)) {
            return;
        }
        List<String> valuesList = new ArrayList<>(values.length);
        for (String value : values) {
            if (Validator.isNull(value)) {
                continue;
            }
            valuesList.add(value.trim());
        }
        if (valuesList.isEmpty()) {
            return;
        }
        values = valuesList.toArray(new String[valuesList.size()]);
        addField(xContentBuilder, field, name, values);
        if (field.isSortable()) {
            String sortFieldName = DocumentImpl.getSortableFieldName(name);
            addField(xContentBuilder, field, sortFieldName, values);
        }
    } else {
        Map<Locale, String> localizedValues = field.getLocalizedValues();
        for (Map.Entry<Locale, String> entry : localizedValues.entrySet()) {
            String value = entry.getValue();
            if (Validator.isNull(value)) {
                continue;
            }
            Locale locale = entry.getKey();
            String languageId = LocaleUtil.toLanguageId(locale);
            String defaultLanguageId = LocaleUtil.toLanguageId(LocaleUtil.getDefault());
            value = value.trim();
            if (languageId.equals(defaultLanguageId)) {
                addField(xContentBuilder, field, name, value);
            }
            String localizedName = DocumentImpl.getLocalizedName(languageId, name);
            addField(xContentBuilder, field, localizedName, value);
            if (field.isSortable()) {
                String sortableFieldName = DocumentImpl.getSortableFieldName(localizedName);
                addField(xContentBuilder, field, sortableFieldName, value);
            }
        }
    }
}

[Buggy Hunk]
if (Validator.isNull(value)) {

[Patch]
if (value == null) {