NumberUtils { public static boolean isNumeric(Class<?> clazz) { return Number.class.isAssignableFrom(clazz) || float.class.equals(clazz) || double.class.equals(clazz) || int.class.isAssignableFrom(clazz) || long.class.isAssignableFrom(clazz) || byte.class.isAssignableFrom(clazz) || short.class.isAssignableFrom(clazz); } private  NumberUtils(); static String format(Object value); static boolean isDouble(Class<?> clazz); static boolean isDouble(Object value); static boolean isFloat(Class<?> clazz); static boolean isInteger(Class<?> clazz); static boolean isInteger(Object value); static boolean isLong(Class<?> clazz); static boolean isLong(Object value); static boolean isNumeric(Class<?> clazz);  }
@Test public void testIsNumeric() { assertFalse(NumberUtils.isNumeric(String.class)); assertTrue(NumberUtils.isNumeric(byte.class)); assertTrue(NumberUtils.isNumeric(int.class)); assertTrue(NumberUtils.isNumeric(long.class)); assertTrue(NumberUtils.isNumeric(short.class)); assertTrue(NumberUtils.isNumeric(double.class)); assertTrue(NumberUtils.isNumeric(float.class)); assertTrue(NumberUtils.isNumeric(BigDecimal.class)); assertTrue(NumberUtils.isNumeric(Integer.class)); assertTrue(NumberUtils.isNumeric(Long.class)); }