[Demonstration 1]

[Buggy Method]
public ArrayList<Condition> getConditionsForIndex(int index) {
    if (mRawData == null) {
        loadRawData();
    } else if (mRawData.isEmpty()) {
        loadRawData();
    }
    if (conditions.isEmpty()) {
        parseForecasts();
    }
    // Return the array of conditions
    ArrayList<Condition> dayConditions = new ArrayList(conditions.subList(index * 6, 6));
    return dayConditions;
}

[Buggy Hunk]
ArrayList<Condition> dayConditions = new ArrayList(conditions.subList(index * 6, 6));

[Patch]
ArrayList<Condition> dayConditions = new ArrayList(conditions.subList(index * 6, (index * 6) + 6));

[Demonstration 2]

[Buggy Method]
public BufferedImage imageConvertToBlackBackgroundFromAll(BufferedImage image) {
    EdgeFilter edgeFilter = new EdgeFilter();
    BufferedImage imageTmp = null;
    BufferedImage imageOut = ImageUtils.cloneImage(image);
    imageTmp = edgeFilter.filter(image, imageTmp);
    // first pass, let's get rid of the background from the left
    int[] colorBlack = new int[] { 0, 0, 0 };
    for (int i = 0; i < imageTmp.getHeight(); i++) {
        for (int j = 0; j < imageTmp.getWidth(); j++) {
            Color c = new Color(imageTmp.getRGB(j, i));
            if (c.getRed() < threshold && c.getGreen() < threshold && c.getBlue() < threshold) {
                ImageUtils.setRGB(imageOut, j, i, 1, 1, colorBlack);
            } else {
                break;
            }
        }
    }
    //now let's do it from the right
    for (int i = 0; i < imageTmp.getHeight(); i++) {
        for (int j = imageTmp.getWidth() - 1; j >= 0; j--) {
            Color c = new Color(imageTmp.getRGB(j, i));
            if (c.getRed() < threshold && c.getGreen() < threshold && c.getBlue() < threshold) {
                ImageUtils.setRGB(imageOut, j, i, 1, 1, colorBlack);
            } else {
                break;
            }
        }
    }
    for (int j = 0; j < imageTmp.getWidth(); j++) {
        for (int i = 0; i < imageTmp.getHeight(); i++) {
            Color c = new Color(imageTmp.getRGB(j, i));
            if (c.getRed() < threshold && c.getGreen() < threshold && c.getBlue() < threshold) {
                ImageUtils.setRGB(imageOut, j, i, 1, 1, colorBlack);
            } else {
                break;
            }
        }
    }
    //now let's do it from the right
    for (int j = 0; j < imageTmp.getWidth(); j++) {
        for (int i = imageTmp.getHeight() - 1; i >= 0; i--) {
            Color c = new Color(imageTmp.getRGB(j, i));
            if (c.getRed() < threshold && c.getGreen() < threshold && c.getBlue() < threshold) {
                ImageUtils.setRGB(imageOut, j, i, 1, 1, colorBlack);
            } else {
                break;
            }
        }
    }
    return imageOut;
}

[Buggy Hunk]
BufferedImage imageOut = ImageUtils.cloneImage(image);

[Patch]
BufferedImage imageOut = image.getSubimage(0, 0, image.getWidth(), image.getHeight());

[Demonstration 3]

[Buggy Method]
public List<LightwaveRFCommand> convertToLightwaveRfMessage(String roomId, String deviceId, LightwaveRfType deviceType, Type command) {
    int messageId = getAndIncrementMessageId();
    LinkedList<LightwaveRFCommand> commandList = new LinkedList<>();
    switch(deviceType) {
        case HEATING_BATTERY:
        case HEATING_CURRENT_TEMP:
        case HEATING_MODE:
        case VERSION:
            throw new IllegalArgumentException(deviceType + " : is read only it can't be set");
        case HEATING_SET_TEMP:
            commandList.add(new LightwaveRfSetHeatingTemperatureCommand(messageId, roomId, ((DecimalType) command).doubleValue()));
            commandList.add(new LightwaveRfHeatInfoRequest(getAndIncrementMessageId(), roomId));
            break;
        case DIMMER:
        case SWITCH:
            if (command instanceof OnOffType) {
                boolean on = (command == OnOffType.ON);
                commandList.add(new LightwaveRfOnOffCommand(messageId, roomId, deviceId, on));
            } else if (command instanceof PercentType) {
                int dimmingLevel = ((PercentType) command).intValue();
                commandList.add(new LightwaveRfDimCommand(messageId, roomId, deviceId, dimmingLevel));
            } else {
                throw new RuntimeException("Unsupported Command: " + command);
            }
            break;
        case RELAY:
            if (command instanceof DecimalType) {
                int state = ((DecimalType) command).intValue();
                commandList.add(new LightwaveRfRelayCommand(messageId, roomId, deviceId, state));
            } else {
                throw new RuntimeException("Unsupported Command: " + command);
            }
            break;
        case MOOD:
            if (command instanceof DecimalType) {
                int state = ((DecimalType) command).intValue();
                commandList.add(new LightwaveRfMoodCommand(messageId, roomId, state));
            } else {
                throw new RuntimeException("Unsupported Command: " + command);
            }
            break;
        case ALL_OFF:
            if (command instanceof OnOffType) {
                commandList.add(new LightwaveRfAllOffCommand(messageId, roomId));
            } else {
                throw new RuntimeException("Unsupported Command: " + command);
            }
            break;
        default:
            throw new IllegalArgumentException(deviceType + " : is unexpected");
    }
    return commandList;
}

[Buggy Hunk]
LinkedList<LightwaveRFCommand> commandList = new LinkedList<>();

[Patch]
LinkedList<LightwaveRFCommand> commandList = new LinkedList<LightwaveRFCommand>();