Ad
  • Custom User Avatar

    Not really. max method uses ?

    public static int max(int a, int b) {
        return (a >= b) ? a : b;
    }
    

    An integer subtraction could be skipped for the case when there isn't enough capacity, although the compiler (Hotspot) is likely to do this optimization anyway.