@Test public void copy() { Number[] numbers = { Byte.valueOf((byte) 0), Short.valueOf((short) 0), Integer.valueOf(0), Float.valueOf(0f), Double.valueOf(0d) }; for (int i = 0; i < numbers.length; i++) { Number result = NumberOperations.copy(numbers[i]); assertEquals(numbers[i].getClass(), result.getClass()); assertEquals(numbers[i].intValue(), result.intValue()); } }
public static Number copy(Number number) { return (number == null ? null : newInstance(number, number.getClass())); }
NumberOperations { public static Number copy(Number number) { return (number == null ? null : newInstance(number, number.getClass())); } }
NumberOperations { public static Number copy(Number number) { return (number == null ? null : newInstance(number, number.getClass())); }  }
NumberOperations { public static Number copy(Number number) { return (number == null ? null : newInstance(number, number.getClass())); }  static Number add(Number n1, Number n2); static Number subtract(Number n1, Number n2); static Number multiply(Number n1, Number n2); static Number divide(Number n1, Number n2); static int compare(Number n1, Number n2); static float getFloatTolerance(); static void setFloatTolerance(float tol); static double getDoubleTolerance(); static void setFloatTolerance(double tol); static int intValue(Number number); static long longValue(Number number); static float floatValue(Number number); static double doubleValue(Number number); static Number copy(Number number); static Number newInstance(Number number, Class<? extends Number> clazz); static Number castNumber(Number number, Class<? extends Number> clazz); static Class<? extends Number> highestClass(Number ...numbers); static Class<? extends Number> lowestClass(Number ...numbers); }
NumberOperations { public static Number copy(Number number) { return (number == null ? null : newInstance(number, number.getClass())); }  static Number add(Number n1, Number n2); static Number subtract(Number n1, Number n2); static Number multiply(Number n1, Number n2); static Number divide(Number n1, Number n2); static int compare(Number n1, Number n2); static float getFloatTolerance(); static void setFloatTolerance(float tol); static double getDoubleTolerance(); static void setFloatTolerance(double tol); static int intValue(Number number); static long longValue(Number number); static float floatValue(Number number); static double doubleValue(Number number); static Number copy(Number number); static Number newInstance(Number number, Class<? extends Number> clazz); static Number castNumber(Number number, Class<? extends Number> clazz); static Class<? extends Number> highestClass(Number ...numbers); static Class<? extends Number> lowestClass(Number ...numbers); static final float DEFAULT_FLOAT_TOL; static final double DEFAULT_DOUBLE_TOL; }