code: public static Class getPrimitiveType(Class type) {
          if (type == int.class || type == Integer.class) {
              return int.class;
          } else if (type == long.class || type == Long.class) {
              return long.class;
          } else if (type == short.class || type == Short.class) {
              return short.class;
          } else if (type == double.class || type == Double.class) {
              return double.class;
          } else if (type == float.class || type == Float.class) {
              return float.class;
          } else if (type == char.class || type == Character.class) {
              return char.class;
          } else if (type == byte.class || type == Byte.class) {
              return byte.class;
          } else if (type == boolean.class || type == Boolean.class) {
              return boolean.class;
          }
          throw new IllegalArgumentException("Type '" + type + "' can not be converted to primitive type.");
      }
docs: getPrimitiveType of the given class
  
  @param type the given class.
  @return the primitive of the given class, eg. Integer/int to int, Double/double to double etc...
  @throws IllegalArgumentException if the given class can not be unpacked to primitive type.