code: public static Object convertNumberToWrapper(Number num, Class<?> wrapper) {
          //XXX Paul: Using valueOf will reduce object creation
          if (wrapper.equals(String.class)) {
              return num.toString();
          } else if (wrapper.equals(Boolean.class)) {
              return Boolean.valueOf(num.intValue() == 1);
          } else if (wrapper.equals(Double.class)) {
              return Double.valueOf(num.doubleValue());
          } else if (wrapper.equals(Long.class)) {
              return Long.valueOf(num.longValue());
          } else if (wrapper.equals(Float.class)) {
              return Float.valueOf(num.floatValue());
          } else if (wrapper.equals(Integer.class)) {
              return Integer.valueOf(num.intValue());
          } else if (wrapper.equals(Short.class)) {
              return Short.valueOf(num.shortValue());
          } else if (wrapper.equals(Byte.class)) {
              return Byte.valueOf(num.byteValue());
          }
          throw new ConversionException(String.format("Unable to convert number to: %s", wrapper));
      }
docs: Convert number to primitive wrapper like Boolean or Float
  
  @param num
  Number to conver
  @param wrapper
  Primitive wrapper type
  @return Converted object