[Demonstration 1]

[Buggy Method]
public static double fahrenheitToCelsiusConverter(double fahrenheitDegrees) {
    double celsiusDegrees = (5 / 9) * (fahrenheitDegrees - 32);
    return celsiusDegrees;
}

[Buggy Hunk]
double celsiusDegrees = (5/9) * (fahrenheitDegrees - 32);

[Patch]
double celsiusDegrees = (5.0/9) * (fahrenheitDegrees - 32);

[Demonstration 2]

[Buggy Method]
public static Result service(String ownerName, String projectName, String service, boolean isAdvertise) throws IOException, UnsupportedOperationException, ServletException {
    if (!isSupportedService(service)) {
        return forbidden(String.format("Unsupported service: '%s'", service));
    }
    Project project = Project.findByOwnerAndProjectName(ownerName, projectName);
    if (project == null) {
        return notFound();
    }
    models.User user = UserApp.currentUser();
    if (!isAllowed(project, service)) {
        if (user.isAnonymous()) {
            return BasicAuthAction.unauthorized(response());
        } else {
            // If you want the Git client showing your custom message to
            // the user, the Content-Type should be exact "text/plain"
            // without any parameter. For more details, see the code at
            // https://github.com/git/git/commit/426e70d4a11ce3b4f70636d57c6a0ab16ae08a00#diff-eea0ad565ec5903a11b6023755d491cfR154
            response().setHeader("Content-Type", "text/plain");
            return forbidden(String.format("'%s' has no permission to '%s/%s'.", user.name, ownerName, projectName));
        }
    }
    if (isAdvertise) {
        return ok(RepositoryService.gitAdvertise(project, service, response()));
    } else {
        if (request().body().isMaxSizeExceeded()) {
            return status(REQUEST_ENTITY_TOO_LARGE);
        } else {
            user.visits(project);
            return ok(RepositoryService.gitRpc(project, service, request(), response()));
        }
    }
}

[Buggy Hunk]
user.name, ownerName, projectName));

[Patch]
user.loginId, ownerName, projectName));

[Demonstration 3]

[Buggy Method]
private void readHistory(byte[] historyData, int length) {
    //count history data fields
    int dataCount = length / 12;
    //set history count initially to zero
    historyLen = 0;
    for (int i = 0; i < dataCount; i++) {
        //check if current field seems to contain data (some date and time bytes are not zeroes)
        if ((historyData[i * 12 + 1] != (byte) 0) || (historyData[i * 12 + 2] != (byte) 0) || (historyData[i * 12 + 3] != (byte) 0) || (historyData[i * 12 + 4] != (byte) 0)) {
            //allocate memory for new history field
            historyFields[historyLen] = new History();
            //Store transaction type
            historyFields[historyLen].setTransactionType((byte) ((historyData[i * 12 + 0] & 0x80) >>> 7));
            //Get transaction date and time (date from transfer end date, and time from boarding time)
            short date = (short) (((historyData[i * 12 + 3] & 0x3F) << 8) | (historyData[i * 12 + 4] & 0xFF));
            short time = (short) (((historyData[i * 12 + 1] & 0x01) << 10) | ((historyData[i * 12 + 2] & 0xFF) << 2) | ((historyData[i * 12 + 3] & 0xC0) >>> 6));
            short endTime = (short) (((historyData[i * 12 + 5] & 0xFF) << 3) | ((historyData[i * 12 + 6] & 0xE0) >>> 5));
            //if transfer end time is before boarding time, the day has changed after boarding
            //and we have to subtract one day from the transfer end date to get real boarding date
            if (endTime < time)
                date -= 1;
            //set visible boarding date and time
            historyFields[historyLen].setTransactionDTime(Convert.en5145DateAndTime2JavaDate(date, time));
            //Get group size
            historyFields[historyLen].setGroupSize((byte) ((historyData[i * 12 + 8] & 0x7C) >>> 2));
            //Get value ticket price
            historyFields[historyLen].setPrice((short) (((historyData[i * 12 + 6] & 0x1F) << 9) | ((historyData[i * 12 + 7] & 0xFF) << 1) | ((historyData[i * 12 + 8] & 0x80) >>> 7)));
            //increment counter
            historyLen++;
        }
    }
}

[Buggy Hunk]
historyFields[historyLen].setTransactionDTime(Convert.en5145DateAndTime2JavaDate(date, time));

[Patch]
historyFields[historyLen].setTransactionDTime(Utilities.en5145DateAndTime2JavaDate(date, time));