class ConcurrencyUtil {

    public static int selectLock(final Object key, int numberOfLocks) throws CacheException {
        int number = numberOfLocks & (numberOfLocks - 1);
        if (number != 0) {
            throw new CacheException("Lock number must be a power of two: " + numberOfLocks);
        }
        if (key == null) {
            return 0;
        } else {
            int hash = hash(key) & (numberOfLocks - 1);
            return hash;
        }

    }

    private  ConcurrencyUtil();

}