[Demonstration 1]

[Buggy Method]
public Integer getGratitudesComplete() {
    Integer gratitudeComplete = 0;
    for (String gratitude : gratitudes) {
        gratitudeComplete += Math.max(100, (gratitude.length() * 100) / MIN_ENTRY_LENGTH);
    }
    return Math.min(100, Long.valueOf(Math.round(gratitudeComplete / 3.0)).intValue());
}

[Buggy Hunk]
gratitudeComplete += Math.max(100, (gratitude.length()*100) / MIN_ENTRY_LENGTH);

[Patch]
gratitudeComplete += Math.min(100, (gratitude.length()*100) / MIN_ENTRY_LENGTH);

[Demonstration 2]

[Buggy Method]
public int getPercentageComplete() {
    return (Math.round(Math.round((100 * (System.currentTimeMillis() - startingTime) / (duration)))));
}

[Buggy Hunk]
return (Math.round(Math.round((100*(System.currentTimeMillis() - startingTime)/(duration)))));

[Patch]
return (int) (Math.round(Math.floor((100*(System.currentTimeMillis() - startingTime)/(duration)))));

[Demonstration 3]

[Buggy Method]
@ReactMethod
public void getLastConsumedMessageIndex(String channelSid, Promise promise) {
    promise.resolve(loadMessagesFromChannelSid(channelSid).getLastConsumedMessageIndex());
}

[Buggy Hunk]
promise.resolve(loadMessagesFromChannelSid(channelSid).getLastConsumedMessageIndex());

[Patch]
promise.resolve(Integer.valueOf(loadMessagesFromChannelSid(channelSid).getLastConsumedMessageIndex().intValue()));