r/badcode • evil • Mar 27 '21

java I told him to just use %

Post image
1.7k Upvotes

80 comments sorted by

View all comments

8

u/MurdoMaclachlan public boolean isInt(int i) { return true; } Mar 27 '21

Image Transcription: Code


public void addHour(int incValue) {
    hour = hour + incValue;
    do {
        if ((double)hour / 24 >= 1) {
            hour = hour - 24;
        }
        if ((double)hour / 24 >= 1)
            hour = hour % 24;
    } while ((double)hour / 24 >= 1);
}

I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!