code: public static Class<?> toPrimitive(Class<?> type) {
          if (type.isPrimitive()) {
              return type;
          } else if (type == Boolean.class) {
              return Boolean.TYPE;
          } else if (type == Character.class) {
              return Character.TYPE;
          } else if (type == Byte.class) {
              return Byte.TYPE;
          } else if (type == Short.class) {
              return Short.TYPE;
          } else if (type == Integer.class) {
              return Integer.TYPE;
          } else if (type == Long.class) {
              return Long.TYPE;
          } else if (type == Float.class) {
              return Float.TYPE;
          } else if (type == Double.class) {
              return Double.TYPE;
          } else {
              return null;
          }
      }
docs: Converts a boxed type to its primitive counterpart.
  
  @param type the type to convert
  @return the primitive counterpart