code: public static int sizeOf(Class<?> clz) throws IllegalArgumentException {
      switch (clz.getName()) {
      case "int":
        return Integer.BYTES;
      case "short":
        return Short.BYTES;
      case "long":
        return Long.BYTES;
      case "double":
        return Double.BYTES;
      case "float":
        return Float.BYTES;
      case "boolean":
        return 1;
      case "char":
        return Character.BYTES;
      case "byte":
        return 1;
      default:
        throw new IllegalArgumentException("Not a primitive type.");
      }
    }
docs: Get the size of a primitive type.
  
  @param clz
  @throws IllegalArgumentException If the class is not primitive type.
  @return