code: static long addCap(long a, long b) {
  
          long res = a + b;
          if (res < 0L) {
              return Long.MAX_VALUE;
          }
          return res;
      }
docs: Cap an addition to Long.MAX_VALUE
  
  @param a left operand
  @param b right operand
  
  @return Addition result or Long.MAX_VALUE if overflow