[Demonstration 1]

[Buggy Method]
public static long highestOneBit(long i) {
    int high = (int) (i >> 32);
    if (high != 0) {
        return ((long) Integer.highestOneBit(high)) << 32;
    } else {
        return Integer.highestOneBit((int) i);
    }
}

[Buggy Hunk]
return Integer.highestOneBit((int) i);

[Patch]
return Integer.highestOneBit((int) i) & 0xFFFFFFFFL;

[Demonstration 2]

[Buggy Method]
public void readFile(String sourceFilePath, String pathTBox, String pathABox) throws IOException {
    System.out.println(sourceFilePath);
    aboxModel.removeAll();
    OntClass ontClass;
    Individual ind = null;
    OntProperty[] ontProps;
    OntProperty propRowNum;
    OntProperty propSourceFile;
    int numProps = 0;
    // name of File becomes owl:Class
    File file = new File(sourceFilePath);
    String sourceFileName = file.getName();
    String clsName = className;
    String clsURI = nsTBox + clsName;
    System.out.println("Create owl class: " + clsURI);
    ontClass = tboxModel.createClass(clsURI);
    List<String[]> lines = null;
    // Open CSV file
    FileInputStream is = new FileInputStream(new File(sourceFilePath));
    char c = separator.charAt(0);
    CSVReader reader = new CSVReader(new InputStreamReader(is, "UTF-8"), c);
    lines = reader.readAll();
    reader.close();
    propRowNum = tboxModel.createDatatypeProperty(nsTBox + "rowNum");
    propSourceFile = tboxModel.createDatatypeProperty(nsTBox + "sourceFileName");
    String[] propNames = lines.get(0);
    ontProps = new OntProperty[propNames.length];
    for (int i = 0; i < propNames.length; i++) {
        if (propNames[i].length() == 0) {
            break;
        }
        String propName = propNames[i].replace("\"", "");
        propName = propName.replace(" ", "_").replace("/", "_").replace("\\", "_").replace(":", "_").replace(".", "_").replace(";", "_");
        propName = propName.substring(0, 1).toLowerCase() + propName.substring(1);
        propName = nsTBox + propName;
        ontProps[i] = tboxModel.createDatatypeProperty(propName);
        numProps++;
    }
    for (int j = 1; j < lines.size(); /* && j<3 */
    j++) {
        System.out.println(j + " out of " + (lines.size() - 1));
        String[] propValues = lines.get(j);
        // Create an individual
        // If key column is given use its value in URI
        if (keyColIndex != -1) {
            String key = propValues[keyColIndex];
            key = safeChar(key);
            ind = aboxModel.createIndividual(nsABox + clsName + "__" + key, ontClass);
        } else {
            ind = aboxModel.createIndividual(nsABox + clsName + "__" + getUniqueIdentifier(), ontClass);
        }
        // add source file name
        ind.addLiteral(propSourceFile, sourceFileName);
        // add row index
        ind.addLiteral(propRowNum, new Integer(j));
        for (int k = 0; k < propValues.length && k < numProps; k++) {
            String propValue = propValues[k];
            propValue = propValue.replaceAll("\"", "");
            propValue = propValue.trim();
            if (propValue.equals("")) {
                continue;
            }
            // If Literal
            try {
                Double fval = new Double(propValue);
                // If integer or double
                if (propValue.indexOf(".") == -1) {
                    // Integer
                    Integer ival = new Integer((int) fval.floatValue());
                    ind.addLiteral(ontProps[k], ival);
                } else {
                    ind.addLiteral(ontProps[k], fval);
                }
            } catch (Exception e) {
                // No it is not number - create string literal
                try {
                    if (textFieldSeparator == null) {
                        ind.addLiteral(ontProps[k], propValue);
                    } else {
                        String[] vals = propValue.split(textFieldSeparator);
                        for (String val : vals) {
                            ind.addLiteral(ontProps[k], val);
                        }
                    }
                } catch (Exception e2) {
                    System.err.println(ontProps[k] + ":" + propValue);
                }
            }
        }
    }
    saveModel(tboxModel, pathTBox);
    saveModel(aboxModel, pathABox);
}

[Buggy Hunk]
Integer ival = new Integer((int) fval.floatValue());

[Patch]
Long ival = new Long((long) fval.doubleValue());

[Demonstration 3]

[Buggy Method]
public static int bitsRequired(int maxValue) {
    return Math.max(1, 64 - Long.numberOfLeadingZeros(maxValue));
}

[Buggy Hunk]
return Math.max(1, 64 - Long.numberOfLeadingZeros(maxValue));

[Patch]
return Math.max(1, 32 - Integer.numberOfLeadingZeros(maxValue));