[Demonstration 1]

[Buggy Method]
public static int calculateTimeSpan(Date start, Date end, ChronoUnit unit) {
    return Math.toIntExact(unit.between(toLocalDate(start), toLocalDate(end)));
}

[Buggy Hunk]
return Math.toIntExact(unit.between(toLocalDate(start), toLocalDate(end)));

[Patch]
return Math.abs(Math.toIntExact(unit.between(toLocalDate(start), toLocalDate(end))));

[Demonstration 2]

[Buggy Method]
@Test
public void testScaleRect() throws Exception {
    RectangleF r = new RectangleF(0, 0, 1920, 1080);
    RectangleF sub = new RectangleF(240, 135, 1440, 810);
    Rectangle test = sub.scaleImmutable(r).asIntRect();
    assertEquals(2560, test.width);
    assertEquals(1440, test.height);
    test = test.asFloatRect().center(r).asIntRect();
    assertEquals(-320, test.x);
    assertEquals(-180, test.y);
}

[Buggy Hunk]
Rectangle test = sub.scaleImmutable(r).asIntRect();

[Patch]
Rectangle test = sub.aspectRatioScaleImmutable(r).asIntRect();

[Demonstration 3]

[Buggy Method]
public synchronized void clear() {
    timeElapsed = 0;
    //      neededTimeStep = 0.5;
    //      timeStep = 0.5;
    getPointMasses().clear();
}

[Buggy Hunk]
getPointMasses().clear();

[Patch]
pointMasses.clear();