MathUtils { public static boolean isCalculatable(Number n) { return (n != null) && isCalculatable(n.doubleValue()); } private  MathUtils(); static boolean almostEqual(double a, double b, double delta); static double round(double a, double precision); static double floor(double a, double precision); static double ceil(double a, double precision); static int binarySearch(double[] a, double key); static int binarySearchFloor(double[] a, double key); static int binarySearchCeil(double[] a, double key); static T limit(T value, T min, T max); static double limit(double value, double min, double max); static float limit(float value, float min, float max); static int limit(int value, int min, int max); static int randomizedSelect(List<T> a,
			int lower, int upper, int i); static double magnitude(double base, double n); static double quantile(List<Double> values, double q); static boolean isCalculatable(Number n); static boolean isCalculatable(double n); static double normalizeDegrees(double angle);  }
@Test public void testIsCalculatable() { assertTrue(MathUtils.isCalculatable(Byte.valueOf((byte) 0))); assertTrue(MathUtils.isCalculatable(Integer.valueOf(0))); assertTrue(MathUtils.isCalculatable(Long.valueOf(0L))); assertTrue(MathUtils.isCalculatable(new Float(0f))); assertTrue(MathUtils.isCalculatable(new Double(0.0))); assertFalse(MathUtils.isCalculatable(null)); assertFalse(MathUtils.isCalculatable(new Double(Double.NaN))); assertFalse(MathUtils.isCalculatable(new Double(Double.NEGATIVE_INFINITY))); assertFalse(MathUtils.isCalculatable(new Double(Double.POSITIVE_INFINITY))); assertTrue(MathUtils.isCalculatable(0.0)); assertFalse(MathUtils.isCalculatable(Double.NaN)); assertFalse(MathUtils.isCalculatable(Double.NEGATIVE_INFINITY)); assertFalse(MathUtils.isCalculatable(Double.POSITIVE_INFINITY)); }