[Demonstration 1]

[Buggy Method]
private int calculateSweepAngleOnSpeedBasis(float speedInMbps) {
    int sweepingAngle = 0;
    // Start with the first index.
    int i = 1;
    while (i < SPEED_INDICATING_VALUES_IN_MB.length) {
        if (speedInMbps <= SPEED_INDICATING_VALUES_IN_MB[i]) {
            break;
        }
        i++;
    }
    if (i >= SPEED_INDICATING_VALUES_IN_MB.length) {
        return ARC_BACKGROUND_SWEEP_ANGLE;
    }
    int numberOfDegreeInEachSection = ARC_BACKGROUND_SWEEP_ANGLE / SPEED_INDICATING_VALUES_IN_MB.length;
    sweepingAngle = (i - 1) * numberOfDegreeInEachSection;
    // We have calculated the floor text pointer sweepingAngle.
    // Calculate the rest increase as well.
    // Lets calculate the difference of speed in the section where our speed is
    // residing.
    float diffOfSpeedInResidingSection = SPEED_INDICATING_VALUES_IN_MB[i] - SPEED_INDICATING_VALUES_IN_MB[i - 1];
    float perDegreeMbIncreaseInResidingSection = diffOfSpeedInResidingSection / numberOfDegreeInEachSection;
    float speedInMppsLeftToBeConsideredInSweepingAngle = speedInMbps - SPEED_INDICATING_VALUES_IN_MB[i - 1];
    // Prepare the array for binary search to find the nearest index where speed belongs
    float[] arrayOfSpeedValues = new float[numberOfDegreeInEachSection];
    for (int y = 0; y < numberOfDegreeInEachSection; y++) {
        arrayOfSpeedValues[y] = y * perDegreeMbIncreaseInResidingSection;
    }
    int nearestIndex = getClosestIndex(arrayOfSpeedValues, speedInMppsLeftToBeConsideredInSweepingAngle);
    sweepingAngle += nearestIndex;
    return sweepingAngle;
}

[Buggy Hunk]
int numberOfDegreeInEachSection = ARC_BACKGROUND_SWEEP_ANGLE / SPEED_INDICATING_VALUES_IN_MB.length;

[Patch]
int numberOfDegreeInEachSection = ARC_BACKGROUND_SWEEP_ANGLE / (SPEED_INDICATING_VALUES_IN_MB.length - 1);

[Demonstration 2]

[Buggy Method]
public MetadataDto getMetadata() {
    try {
        if (metadata == null) {
            Properties properties = new Properties();
            properties.load(new FileInputStream(new File(applicationDirPath + "/config.properties")));
            metadata = MetadataUtils.initMetadata(SystemEntityType.TIMESTAMP_SERVER, entityId, properties, signingCert, signingCert);
            metadata.setTrustedEntities(trustedEntities);
        }
        metadata.setValidUntil(ZonedDateTime.now().plus(defaultMetadataLiveInHours, ChronoUnit.HOURS).toInstant().toString());
        return metadata;
    } catch (Exception ex) {
        throw new RuntimeException(Messages.currentInstance().get("invalidMetadataMsg") + " - " + ex.getMessage());
    }
}

[Buggy Hunk]
metadata.setValidUntil(ZonedDateTime.now().plus(defaultMetadataLiveInHours, ChronoUnit.HOURS)

[Patch]
metadata.setValidUntil(ZonedDateTime.now().plus(DEFAULT_METADATA_LIVE_IN_HOURS, ChronoUnit.HOURS)

[Demonstration 3]

[Buggy Method]
@Override
public boolean equals(Object o) {
    if (o == this) {
        return true;
    } else if (o == null) {
        return false;
    }
    if (o.getClass() == getClass()) {
        ExtensibleJsonObject obj = (ExtensibleJsonObject) o;
        return obj.metadata.equals(metadata);
    }
    return false;
}

[Buggy Hunk]
return obj.metadata.equals(metadata);

[Patch]
return metadataEquals(obj.metadata, metadata);