### Question:
Utils { public static Object castNumberType(Object object, Class clazz) { if (Number.class.isAssignableFrom(clazz)) { if (Double.class.isAssignableFrom(clazz)) { return ((Number) object).doubleValue(); } else if (Long.class.isAssignableFrom(clazz)) { return ((Number) object).longValue(); } else if (Float.class.isAssignableFrom(clazz)) { return ((Number) object).floatValue(); } else if (Integer.class.isAssignableFrom(clazz)) { return ((Number) object).intValue(); } else if (Short.class.isAssignableFrom(clazz)) { return ((Number) object).shortValue(); } else if (Byte.class.isAssignableFrom(clazz)) { return ((Number) object).byteValue(); } else if (BigInteger.class.isAssignableFrom(clazz)) { return BigInteger.valueOf(((Number) object).longValue()); } else if (BigDecimal.class.isAssignableFrom(clazz)) { return BigDecimal.valueOf(((Number) object).longValue()); } else if (AtomicLong.class.isAssignableFrom(clazz)) { return new AtomicLong(((Number) object).longValue()); } else if (AtomicInteger.class.isAssignableFrom(clazz)) { return new AtomicInteger(((Number) object).intValue()); } } throw new ClassCastException("it is not a Number Type" + object.getClass() + "|" + clazz); } private  Utils(); static T newTypeInstance(Class<T> clazz); @SuppressWarnings("unchecked") static T newTypeInstance(String className, Class<T> returnClass); static String quote(String identifier); static String singleQuote(String identifier); static String batchQueryGenerator(List<String> statements); static Tuple2<String[], Object[]> prepareTuple4CqlDriver(Tuple2<Cells, Cells> tuple); @SuppressWarnings("unchecked") static Method findSetter(String propertyName, Class entityClass, Class valueType); static boolean setFieldWithReflection(Object object, String fieldName, Object fieldValue); @SuppressWarnings("unchecked") static Method findGetter(String propertyName, Class entityClass); static InetAddress inetAddressFromLocation(String location); static Field[] getAllFields(Class clazz); static List<String> removeAddressPort(List<String> stringList); static String splitListByComma(List<String> hosts); static IExtractor<T, S> getExtractorInstance(S config); static Object castNumberType(Object object, Class clazz); static Object castingUtil(String value, Class classCasting); static W initConfig(S config, W deepJobConfig); static T cloneObjectWithParents(T t); static ExecutorService newBlockingFixedThreadPoolExecutor(int nThreads, int queueSize);  }### Answer:
@Test public void testCastNumberType() throws Exception { Object aDouble = 10D; Object o ; o = castNumberType(aDouble, AtomicInteger.class); assertEquals(AtomicInteger.class, o.getClass()); o = castNumberType(aDouble, AtomicLong.class); assertEquals(AtomicLong.class, o.getClass()); o = castNumberType(aDouble, BigDecimal.class); assertEquals(BigDecimal.class, o.getClass()); o = castNumberType(aDouble, BigInteger.class); assertEquals(BigInteger.class, o.getClass()); o = castNumberType(aDouble, Byte.class); assertEquals(Byte.class, o.getClass()); o = castNumberType(aDouble, Double.class); assertEquals(Double.class, o.getClass()); o = castNumberType(aDouble, Float.class); assertEquals(Float.class, o.getClass()); o = castNumberType(aDouble, Integer.class); assertEquals(Integer.class, o.getClass()); o = castNumberType(aDouble, Long.class); assertEquals(Long.class, o.getClass()); o = castNumberType(aDouble, Short.class); assertEquals(Short.class, o.getClass()); }