@@ -534,7 +534,10 @@ public static long gcd(long a, long b) {
534534 * Returns the sum of {@code a} and {@code b}, provided it does not overflow.
535535 *
536536 * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated; use {@link
537- * Math#addExact(long, long)} instead.
537+ * Math#addExact(long, long)} instead. Note that if both arguments are {@code int} values, writing
538+ * {@code Math.addExact(a, b)} will call the {@link Math#addExact(int, int)} overload, not {@link
539+ * Math#addExact(long, long)}. Also note that adding two {@code int} values can <b>never</b>
540+ * overflow a {@code long}, so you can just write {@code (long) a + b}.
538541 *
539542 * @throws ArithmeticException if {@code a + b} overflows in signed {@code long} arithmetic
540543 */
@@ -547,7 +550,11 @@ public static long checkedAdd(long a, long b) {
547550 * Returns the difference of {@code a} and {@code b}, provided it does not overflow.
548551 *
549552 * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated; use {@link
550- * Math#subtractExact(long, long)} instead.
553+ * Math#subtractExact(long, long)} instead. Note that if both arguments are {@code int} values,
554+ * writing {@code Math.subtractExact(a, b)} will call the {@link Math#subtractExact(int, int)}
555+ * overload, not {@link Math#subtractExact(long, long)}. Also note that subtracting two {@code
556+ * int} values can <b>never</b> overflow a {@code long}, so you can just write {@code (long) a -
557+ * b}.
551558 *
552559 * @throws ArithmeticException if {@code a - b} overflows in signed {@code long} arithmetic
553560 */
@@ -560,7 +567,11 @@ public static long checkedSubtract(long a, long b) {
560567 * Returns the product of {@code a} and {@code b}, provided it does not overflow.
561568 *
562569 * <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated; use {@link
563- * Math#multiplyExact(long, long)} instead.
570+ * Math#multiplyExact(long, long)} instead. Note that if both arguments are {@code int} values,
571+ * writing {@code Math.multiplyExact(a, b)} will call the {@link Math#multiplyExact(int, int)}
572+ * overload, not {@link Math#multiplyExact(long, long)}. Also note that multiplying two {@code
573+ * int} values can <b>never</b> overflow a {@code long}, so you can just write {@code (long) a *
574+ * b}.
564575 *
565576 * @throws ArithmeticException if {@code a * b} overflows in signed {@code long} arithmetic
566577 */
0 commit comments