code: public static Number convert(Number value, Class<?> type) {
          if (int.class.equals(type) || Integer.class.equals(type))
              value = value.intValue();
          else if (long.class.equals(type) || Long.class.equals(type))
              value = value.longValue();
          else if (short.class.equals(type) || Short.class.equals(type))
              value = value.shortValue();
          else if (byte.class.equals(type) || Byte.class.equals(type))
              value = value.byteValue();
          else if (double.class.equals(type) || Double.class.equals(type))
              value = value.doubleValue();
          else if (float.class.equals(type) || Float.class.equals(type))
              value = value.floatValue();
          return value;
      }
docs: Converts a Number value to a Integer, Long, Short, Byte, Double, or Float.
  If unable to convert, the original value is returned.
  
  @param value a numeric value.
  @param type the desired type, which should be one of (Integer, Long, Short, Byte, Double, Float).
  @return converted value.