long entityCode = pkValueWithCode & (1 << ERXLongPrimaryKeyFactory.CODE_LENGTH) - 1;
long entityCode = pkValueWithCode & ((1 << ERXLongPrimaryKeyFactory.CODE_LENGTH) - 1);
    public EOEntity subEntityForEntity(EOEntity entity, NSDictionary pkDict) {        if (ERXLongPrimaryKeyFactory.encodeEntityInPkValue()) {            //get the code, we assume that the pkDict contains only one pk value!            NSArray values = pkDict.allValues();            if (values.count() > 1) throw new IllegalArgumentException("subEntityForEntity in its default implementation"+                    " works only with single pk long values ");            long pkValueWithCode;            try {                Number n = (Number) values.objectAtIndex(0);                pkValueWithCode = n.longValue();            } catch (ClassCastException e) {                throw new IllegalArgumentException("subEntityForEntity in its default implementation"+                " works only with single pk long values, expected a java.lang.Number but got a "+values.objectAtIndex(0));            }            long entityCode = pkValueWithCode & (1 << ERXLongPrimaryKeyFactory.CODE_LENGTH) - 1;            if (entityCode == 0) return null;            for (Enumeration subEntities = entity.subEntities().objectEnumerator(); subEntities.hasMoreElements();) {                EOEntity subEntity = (EOEntity) subEntities.nextElement();                if (((ERXModelGroup) ERXApplication.erxApplication().defaultModelGroup()).entityCode(subEntity) == entityCode) {                    return subEntity;                }            }        }        return null;    }