public static int sizeOfField(Class<?> type) {
        if (!type.isPrimitive())
            return SPEC.getReferenceSize();
        if (type == boolean.class || type == byte.class)
            return 1;
        else if (type == char.class || type == short.class)
            return 2;
        else if (type == float.class || type == int.class)
            return 4;
        else if (type == double.class || type == long.class)
            return 8;
        throw new IllegalStateException();
    }
public static int sizeOfField ( Class < ? > type ) { if ( ! type . isPrimitive ( ) ) return SPEC . getReferenceSize ( ) ; if ( type == boolean . class || type == byte . class ) return 1 ; else if ( type == char . class || type == short . class ) return 2 ; else if ( type == float . class || type == int . class ) return 4 ; else if ( type == double . class || type == long . class ) return 8 ; throw new IllegalStateException ( ) ; }
@return The memory size of a field of a class of the provided type; for Objects this is the size of the reference only