private long sizeOfType(Class<?> type) {
      if (type == int.class) {
        return INT;
      } else if (type == long.class) {
        return LONG;
      } else if (type == byte.class) {
        return BYTE;
      } else if (type == boolean.class) {
        return BOOLEAN;
      } else if (type == char.class) {
        return CHAR;
      } else if (type == float.class) {
        return FLOAT;
      } else if (type == double.class) {
        return DOUBLE;
      } else if (type == short.class) {
        return SHORT;
      } else
        return REFERENCE;
    }