[Demonstration 1]

[Buggy Method]
public static float variance(final float[] array, final int offset, final int length) {
    final float mean = arithmeticMean(array, offset, length);
    double sum = 0;
    for (int i = offset; i < offset + length; i++) {
        final float diff = array[i] - mean;
        sum += diff * diff / array.length;
    }
    return (float) sum;
}

[Buggy Hunk]
sum += diff * diff / array.length;

[Patch]
sum += (diff * diff) / length;

[Demonstration 2]

[Buggy Method]
public static String bytesToString(long bytes) {
    double bytesDouble = bytes;
    int div = 2 << 30;
    int index = 0;
    String postfix = bytes + "bytes";
    while (index <= MODS.length) {
        double divided = bytesDouble / div;
        if (divided > 2) {
            String mod = MODS[index];
            return format.get().format(divided) + mod + " " + postfix;
        }
        div >>= 10;
        index++;
    }
    return postfix;
}

[Buggy Hunk]
int div = 2 << 30;

[Patch]
long div = 2L << 30;

[Demonstration 3]

[Buggy Method]
public GlobalVarNode makeGlobalVarNode(Object value, Type type) {
    if (opts.rta()) {
        value = null;
        type = RefType.v("java.lang.Object");
    }
    GlobalVarNode ret = valToGlobalVarNode.get(value);
    if (ret == null) {
        valToGlobalVarNode.put(value, ret = new GlobalVarNode(this, value, type));
        if (opts.library() != SparkOptions.library_disabled && type instanceof RefType) {
            RefType rt = (RefType) type;
            if (value instanceof SootField) {
                SootField sf = (SootField) value;
                if (sf.isPublic() || sf.isProtected())
                    if (opts.library() == SparkOptions.library_any_subtype) {
                        Node alloc = makeAllocNode(value, AnySubType.v(rt), null);
                        addEdge(alloc, ret);
                    } else if (opts.library() == SparkOptions.library_name_resolution) {
                        Node alloc = makeAllocNode(value, AnySubType.v(rt), null);
                        addEdge(alloc, ret);
                    }
            }
        }
        addNodeTag(ret, null);
    } else if (!(ret.getType().equals(type))) {
        throw new RuntimeException("Value " + value + " of type " + type + " previously had type " + ret.getType());
    }
    return ret;
}

[Buggy Hunk]
Node alloc = makeAllocNode(value, AnySubType.v(rt), null);

[Patch]
Node alloc = makeAllocNode(value, AnyPossibleSubType.v(rt), null);