@Test public void testMultiplyExactLongLong() { assertTrue(MathUtils.multiplyExact(2L, 2L) == 4); assertTrue(MathUtils.multiplyExact(2L, Long.MAX_VALUE) == Long.MAX_VALUE); }
public static int multiplyExact(int x, int y) { try { return Math.multiplyExact(x, y); } catch (ArithmeticException e) { return Integer.MAX_VALUE; } }
MathUtils { public static int multiplyExact(int x, int y) { try { return Math.multiplyExact(x, y); } catch (ArithmeticException e) { return Integer.MAX_VALUE; } } }
MathUtils { public static int multiplyExact(int x, int y) { try { return Math.multiplyExact(x, y); } catch (ArithmeticException e) { return Integer.MAX_VALUE; } }  }
MathUtils { public static int multiplyExact(int x, int y) { try { return Math.multiplyExact(x, y); } catch (ArithmeticException e) { return Integer.MAX_VALUE; } }  static int addExact(int x, int y); static long addExact(long x, long y); static int multiplyExact(int x, int y); static long multiplyExact(long x, long y); static double distance(int x1, int y1, int x2, int y2); static double distance(double x1, double y1, double x2, double y2); static double distance(Point p1, Point p2); static boolean adjacent(int x1, int y1, int x2, int y2); static boolean adjacent(Point p1, Point p2); static int floorInt(double a); static long floorLong(double a); static int ceilInt(double a); static long ceilLong(double a); static float formatScale(float value, int newScale); static float formatScale(float value, int newScale, RoundingMode mode); static double formatScale(double value, int newScale); static double formatScale(double value, int newScale, RoundingMode mode); static Map<T, Long> plunder(Map<T, Long> resources, long max, Map<T, Integer> ratio); static double longToDouble(long value, double ratio); static double permillage(long value); static double percentage(long value); }
MathUtils { public static int multiplyExact(int x, int y) { try { return Math.multiplyExact(x, y); } catch (ArithmeticException e) { return Integer.MAX_VALUE; } }  static int addExact(int x, int y); static long addExact(long x, long y); static int multiplyExact(int x, int y); static long multiplyExact(long x, long y); static double distance(int x1, int y1, int x2, int y2); static double distance(double x1, double y1, double x2, double y2); static double distance(Point p1, Point p2); static boolean adjacent(int x1, int y1, int x2, int y2); static boolean adjacent(Point p1, Point p2); static int floorInt(double a); static long floorLong(double a); static int ceilInt(double a); static long ceilLong(double a); static float formatScale(float value, int newScale); static float formatScale(float value, int newScale, RoundingMode mode); static double formatScale(double value, int newScale); static double formatScale(double value, int newScale, RoundingMode mode); static Map<T, Long> plunder(Map<T, Long> resources, long max, Map<T, Integer> ratio); static double longToDouble(long value, double ratio); static double permillage(long value); static double percentage(long value); static final double ONE; static final double HUNDRED; static final double THOUSAND; static final double TEN_THOUSAND; static final double MILLION; }