Given this simple function:
static int max(int first, int second) {
return Math.max(first, second);
}It works fine, at least until someone passes in something like that:
int bigger = max(2147483646 + 2, 1);
The value returned is somewhat not expected, bigger will be 1, this is because of overflow of integral types, which is specified in Java Language Spec. When we're coding simple functions, bare in mind that bugs might occur even in a single line function.