MCPcopy Create free account
hub / github.com/MenoData/Time4J / safeCast

Method safeCast

base/src/main/java/net/time4j/base/MathUtils.java:61–69  ·  view source on GitHub ↗
(long num)

Source from the content-addressed store, hash-verified

59 * @throws ArithmeticException if int-range overflows
60 */
61 public static int safeCast(long num) {
62
63 if (num < Integer.MIN_VALUE || num > Integer.MAX_VALUE) {
64 throw new ArithmeticException("Out of range: " + num);
65 } else {
66 return (int) num;
67 }
68
69 }
70
71 /**
72 * <p>Sums up the numbers with range check. </p>

Callers 15

addToMethod · 0.95
convertMethod · 0.95
fromEpochMonthsMethod · 0.95
getCountMethod · 0.95
addToMethod · 0.95
addToMethod · 0.95
transformMethod · 0.95
addToMethod · 0.95
addToMethod · 0.95
addToMethod · 0.95
addToMethod · 0.95
erasAddedMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected