[Demonstration 1]

[Buggy Method]
public Boolean addPawn(Pawn pawn) {
    // If first pawn, get as current one
    Boolean placed = false;
    if (pawns.size() == 0) {
        currentPawn = pawn;
    }
    if (pawn.getX() <= xSize && pawn.getY() <= ySize) {
        if (getSquareContent(pawn.getX(), pawn.getY()) == null) {
            this.pawns.add(pawn);
            placed = true;
        } else {
            unplacedPawns.add(pawn);
        }
    } else {
        unplacedPawns.add(pawn);
    }
    return placed;
}

[Buggy Hunk]
if (pawn.getX() <= xSize && pawn.getY() <= ySize) {

[Patch]
if (pawn.getX() < xSize && pawn.getY() < ySize) {

[Demonstration 2]

[Buggy Method]
private static String getDateStatus(Date p_dueDate, Date p_refDate, String p_beforeStr) {
    // make all day events be measure against start of today
    p_refDate = isAllDay(p_dueDate) ? makeStartOfDay(p_refDate) : p_refDate;
    int x_weeks = 0;
    int x_days;
    int x_hours;
    int x_minutes;
    int x_seconds;
    long x_diff = p_dueDate.getTime() - p_refDate.getTime();
    long x_time = Math.abs(x_diff);
    boolean x_past = x_diff < 0;
    x_diff = Math.abs(x_diff);
    x_days = (int) (x_time / (1000 * 60 * 60 * 24));
    if (x_days > 10) {
        x_weeks = x_days / 7;
        x_days = x_days % 7;
    }
    x_hours = (int) ((x_time / (1000 * 60 * 60)) % 24);
    x_minutes = (int) ((x_time / (1000 * 60)) % 60);
    x_seconds = (int) ((x_time / (1000)) % 60);
    StringBuilder x_buffer = new StringBuilder();
    if (!x_past && x_seconds > 0) {
        x_minutes += 1;
        if (x_minutes == 60) {
            x_hours += 1;
            x_minutes = 0;
            if (x_hours == 24) {
                x_days += 1;
                x_hours %= 24;
                if (x_days > 10) {
                    x_weeks += 1;
                    x_days %= 7;
                }
            }
        }
    }
    if (x_days > 0 && !(x_past ? p_dueDate.after(DateUtil.getFirstThingYesterday()) : p_dueDate.before(DateUtil.getLastThingTomorrow()))) {
        if (x_hours > 0 || x_minutes > 0 || x_seconds > 0) {
            x_days = x_days + 1;
            if ((x_weeks == 0 && x_days > 10) || (x_weeks > 0 && x_days == 7)) {
                x_weeks = x_weeks + 1;
                x_days = x_days % 7;
            }
        }
    }
    if (showingWeeks(x_weeks)) {
        x_buffer.append(x_weeks).append("w ");
    }
    if (showingDays(x_weeks, x_days)) {
        x_buffer.append(x_days).append("d ");
    }
    if (showingHours(x_past, x_hours, p_dueDate)) {
        x_buffer.append(x_hours).append("h ");
    }
    if (showingMinutes(x_past, x_minutes, p_dueDate)) {
        x_buffer.append(x_minutes).append("m ");
    }
    if (x_past) {
        if (x_diff < 60 * 1000) {
            x_buffer.append("Now");
        } else {
            x_buffer.append(p_beforeStr);
        }
    } else {
        if (x_diff == 0) {
            x_buffer.append("Today");
        }
    }
    return x_buffer.toString();
}

[Buggy Hunk]
if(x_hours > 0 || x_minutes > 0 || x_seconds > 0) {

[Patch]
if((x_hours > 0 || x_minutes > 0 || x_seconds > 0) && timeIsBefore(p_dueDate, p_refDate)) {

[Demonstration 3]

[Buggy Method]
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
    int x = 1;
    int z = 1;
    int y = 1;
    int mDoorCount = 0;
    int mHullCount = 0;
    int mPlascreteCount = 0;
    for (int i = 1; i < 8; i++) {
        Block tBlock = aBaseMetaTileEntity.getBlockOffset(i, 0, 0);
        int tMeta = aBaseMetaTileEntity.getMetaIDOffset(i, 0, 0);
        if (tBlock != GregTech_API.sBlockCasings3 || tMeta != 11) {
            if (tBlock == GregTech_API.sBlockReinforced || tMeta == 2) {
                x = i;
                z = i;
                break;
            } else {
                return false;
            }
        }
    }
    for (int i = -1; i > -16; i--) {
        Block tBlock = aBaseMetaTileEntity.getBlockOffset(x, i, z);
        int tMeta = aBaseMetaTileEntity.getMetaIDOffset(x, i, z);
        if (tBlock != GregTech_API.sBlockReinforced || tMeta != 2) {
            y = i + 1;
            break;
        }
    }
    if (y > -2) {
        return false;
    }
    for (int dX = -x; dX <= x; dX++) {
        for (int dZ = -z; dZ <= z; dZ++) {
            for (int dY = 0; dY >= y; dY--) {
                if (dX == -x || dX == x || dY == -y || dY == y || dZ == -z || dZ == z) {
                    Block tBlock = aBaseMetaTileEntity.getBlockOffset(dX, dY, dZ);
                    int tMeta = aBaseMetaTileEntity.getMetaIDOffset(dX, dY, dZ);
                    if (y == 0) {
                        if (dX == -x || dX == x || dZ == -z || dZ == z) {
                            if (tBlock != GregTech_API.sBlockReinforced || tMeta != 2) {
                                return false;
                            }
                        } else if (dX == 0 && dZ == 0) {
                        } else {
                            if (tBlock != GregTech_API.sBlockCasings3 || tMeta != 11) {
                                return false;
                            }
                        }
                    } else if (tBlock == GregTech_API.sBlockReinforced && tMeta == 2) {
                        mPlascreteCount++;
                    } else {
                        IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(dX, dY, dZ);
                        if ((!addMaintenanceToMachineList(tTileEntity, 82)) && (!addEnergyInputToMachineList(tTileEntity, 82))) {
                            if (tBlock instanceof ic2.core.block.BlockIC2Door) {
                                mDoorCount++;
                            } else {
                                if (tTileEntity == null) {
                                    {
                                        return false;
                                    }
                                }
                                IMetaTileEntity aMetaTileEntity = tTileEntity.getMetaTileEntity();
                                if (aMetaTileEntity == null) {
                                    return false;
                                }
                                if (aMetaTileEntity instanceof GT_MetaTileEntity_BasicHull) {
                                    mHullCount++;
                                } else {
                                    return false;
                                }
                            }
                        }
                    }
                } else {
                }
            }
        }
    }
    if (mMaintenanceHatches.size() != 1 || mEnergyHatches.size() != 1 || mDoorCount != 2 || mHullCount > 10) {
        return false;
    }
    for (int dX = -x + 1; dX <= x - 1; dX++) {
        for (int dZ = z + 1; dZ <= z - 1; dZ++) {
            for (int dY = -1; dY >= y + 1; dY--) {
                IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(dX, dY, dZ);
                if (tTileEntity != null) {
                    IMetaTileEntity aMetaTileEntity = tTileEntity.getMetaTileEntity();
                    if (aMetaTileEntity != null && aMetaTileEntity instanceof GT_MetaTileEntity_BasicMachine_GT_Recipe) {
                        ((GT_MetaTileEntity_BasicMachine_GT_Recipe) aMetaTileEntity).mCleanroom = this;
                    }
                }
            }
        }
    }
    return true;
}

[Buggy Hunk]
for(int dZ=z+1;dZ<=z-1;dZ++){

[Patch]
for(int dZ=-z+1;dZ<=z-1;dZ++){