[Demonstration 1]

[Buggy Method]
private TextLengthBarState getCurrentState(int count) {
    for (int i = 0; states != null && i < states.size(); i++) {
        if (i == 0) {
            if (count > minChars && count < states.get(0).getCharsLimit()) {
                return states.get(0);
            }
        } else if (i > 0 && i < (states.size() - 1)) {
            if (count >= states.get(i - 1).getCharsLimit() && count < states.get(i).getCharsLimit()) {
                return states.get(i);
            }
        } else {
            if (count >= states.get(i - 1).getCharsLimit()) {
                return states.get(i);
            }
        }
    }
    return null;
}

[Buggy Hunk]
if (count > minChars && count < states.get(0).getCharsLimit()) {

[Patch]
if (count >= minChars && count < states.get(0).getCharsLimit()) {

[Demonstration 2]

[Buggy Method]
public static String[] fizzBuzz(int n) {
    String[] printList = new String[n];
    for (int i = 1; i <= n; i++) {
        if (i % 3 == 0 && i % 5 == 0) {
            printList[i - 1] = "Fizz Buzz";
        } else if (i % 3 == 0) {
            printList[i - 1] = "Fizz";
        } else if (i % 5 == 0) {
            printList[i - 1] = "Buzz";
        } else {
            printList[i - 1] = i;
        }
    }
    return printList;
}

[Buggy Hunk]
printList[i-1] = i;

[Patch]
printList[i-1] = String.valueOf(i);

[Demonstration 3]

[Buggy Method]
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/get/pm/{pm}")
public //Retrieves information on an individual user
String getPM(@PathParam("pm") String pm) throws IOException {
    JSONObject responseObject = new JSONObject();
    String fileString = new String(Files.readAllBytes(Paths.get("config.txt")), StandardCharsets.UTF_8);
    if (fileString.toLowerCase().contains(pm.toLowerCase())) {
        int startIndex = fileString.indexOf(pm);
        int length = fileString.substring(startIndex).indexOf(";");
        int finalIndex = startIndex + length;
        String pmString = fileString.substring(startIndex, finalIndex);
        String[] pmData = pmString.split(",");
        responseObject.put("pm", pm);
        responseObject.put("email", pmData[2]);
    }
    return responseObject.toString();
}

[Buggy Hunk]
responseObject.put("email", pmData[2]);

[Patch]
responseObject.put("email", pmData[1]);