public static Number castTo(Class<?> c, Number number) {

		String primitiveString = null;

		if (ReflectionUtil.primitiveTypeMapper.containsKey(c)) {
			//e.g. Double.TYPE or double.class
			primitiveString = (String)ReflectionUtil.primitiveTypeMapper.get(c)[0];
		} else if (ReflectionUtil.primitiveClassMapper.containsKey(c)) {
			//e.g. Double.class
			primitiveString = (String)ReflectionUtil.primitiveClassMapper.get(c)[0];
		}

		if (primitiveString == null) {
			throw new NumberUtilError("Invalid number cast. " + c.getCanonicalName() + " is not a valid class.");
		}

		switch (primitiveString) {
		case "int":
			return number.intValue();
		case "short":
			return number.shortValue();
		case "long":
			return number.longValue();
		case "double":
			return number.doubleValue();
		case "float":
			return number.floatValue();
		default:
			break;
		}

		throw new NumberUtilError("Invalid number cast. " + c.getCanonicalName() + " is not a valid class.");
	}