[Demonstration 1]

[Buggy Method]
private String calculateTarget(ArrayList<String> blockInfo, int height) {
    if ((height % 100) != 0) {
        System.out.println("Construct calc target mod not 100");
        return blockInfo.get(2);
    } else {
        BigInteger time1 = BigInteger.valueOf(db.getTimeOfPastBlock(blockInfo, 0));
        BigInteger time100 = BigInteger.valueOf(db.getTimeOfPastBlock(blockInfo, 99));
        BigInteger timeDifference = time1.subtract(time100);
        //10 minute goal time per block
        BigInteger goalTime = BigInteger.valueOf(99 * 10 * 60 * 1000);
        BigInteger oldTarget = new BigInteger(blockInfo.get(2), 16);
        BigInteger holdingPattern = oldTarget.multiply(timeDifference);
        BigInteger newTarget = holdingPattern.divide(goalTime);
        String output = newTarget.toString(16);
        System.out.println("construct calcTarget output: " + output + " time1:" + time1 + " time100: " + time100 + " difference: " + timeDifference + " goaltime: " + goalTime);
        if (output.length() > 64 || output.length() == 0 || (output.length() == 64 && (output.charAt(0) != '0' || output.charAt(1) != '0'))) {
            System.out.println("construct calcTarget output too big");
            return "00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";
        }
        while (output.length() < 64) {
            output = "0" + output;
        }
        return output;
    }
}

[Buggy Hunk]
output.charAt(1) != '0'))){

[Patch]
output.charAt(1) != '0')) || (output.length() == 63 && output.charAt(0) != '0')){

[Demonstration 2]

[Buggy Method]
@Override
public void mouseDragged(MouseEvent e) {
    int fromRow = table.getSelectedRow();
    if (fromRow >= 0) {
        draggingRow = true;
        int rowHeight = table.getRowHeight();
        int middleOfSelectedRow = (rowHeight * fromRow) + (rowHeight / 2);
        int toRow = -1;
        int yMousePoint = (int) e.getPoint().getY();
        if (yMousePoint < (middleOfSelectedRow - rowHeight)) {
            // Move row up
            toRow = fromRow - 1;
        } else if (yMousePoint > (middleOfSelectedRow + rowHeight)) {
            // Move row down
            toRow = fromRow + 1;
        }
        if (toRow >= 0 && toRow < table.getRowCount()) {
            TableModel model = (TableModel) table.getModel();
            Matrix matrix = ((MatrixTableModel) table.getModel()).getMatrix();
            Vector<String> rowName = ((MatrixTableModel) table.getModel()).getMatrix().getRowNames();
            String temp_rowName = rowName.get(toRow);
            rowName.set(toRow, rowName.get(fromRow));
            rowName.set(fromRow, temp_rowName);
            for (int i = 0; i < model.getColumnCount(); i++) {
                Object fromValue = model.getValueAt(fromRow, i);
                Object toValue = model.getValueAt(toRow, i);
                double fromValue_matrix = matrix.getMatrix().get(fromRow, i);
                double toValue_matrix = matrix.getMatrix().get(toRow, i);
                model.setValueAt(toValue, fromRow, i);
                matrix.getMatrix().set(fromRow, i, toValue_matrix);
                model.setValueAt(fromValue, toRow, i);
                matrix.getMatrix().set(toRow, i, fromValue_matrix);
            }
            table.setRowSelectionInterval(toRow, toRow);
            startDragPoint = yMousePoint;
        }
        dyOffset = (startDragPoint - yMousePoint) * -1;
        table.repaint();
    }
}

[Buggy Hunk]
for (int i = 0; i < model.getColumnCount(); i++) {

[Patch]
for (int i = 0; i < model.getColumnCount() - 1; i++) {

[Demonstration 3]

[Buggy Method]
int evaluateSingleMaterialPosition(int pieceScore, int[][] positionScore, int posX, int posY, boolean isWhite) {
    int singleScore = pieceScore;
    if (isWhite) {
        singleScore += positionScore[posX][posY];
    } else {
        singleScore += positionScore[8 - posX][8 - posY];
    }
    return singleScore;
}

[Buggy Hunk]
singleScore += positionScore[8-posX][8-posY];

[Patch]
singleScore += positionScore[7-posX][7-posY];