Buggy code:
public class ConcurrentReferenceHashMap < K , V > extends AbstractMap < K , V > implements ConcurrentMap < K , V > { private static final int DEFAULT_INITIAL_CAPACITY = 16 ; private static final float DEFAULT_LOAD_FACTOR = 0.75F ; private static final int DEFAULT_CONCURRENCY_LEVEL = 16 ; private static final ConcurrentReferenceHashMap . ReferenceType DEFAULT_REFERENCE_TYPE = ConcurrentReferenceHashMap . ReferenceType . SOFT ; private static final int MAXIMUM_CONCURRENCY_LEVEL = 1 << 16 ; private static final int MAXIMUM_SEGMENT_SIZE = 1 << 30 ; private final ConcurrentReferenceHashMap < K , V > . Segment [ ] segments ; private final float loadFactor ; private final ConcurrentReferenceHashMap . ReferenceType referenceType ; private final int shift ; private Set < Map . Entry < K , V > > entrySet ; public ConcurrentReferenceHashMap ( ) { } public ConcurrentReferenceHashMap ( int initialCapacity ) { } public ConcurrentReferenceHashMap ( int initialCapacity , float loadFactor ) { } public ConcurrentReferenceHashMap ( int initialCapacity , int concurrencyLevel ) { } public ConcurrentReferenceHashMap ( int initialCapacity , ConcurrentReferenceHashMap . ReferenceType referenceType ) { } public ConcurrentReferenceHashMap ( int initialCapacity , float loadFactor , int concurrencyLevel ) { } @ SuppressWarnings ( "unchecked" ) public ConcurrentReferenceHashMap ( int initialCapacity , float loadFactor , int concurrencyLevel , ConcurrentReferenceHashMap . ReferenceType referenceType ) { } protected final float getLoadFactor ( ) { } protected final int getSegmentsSize ( ) { } protected final ConcurrentReferenceHashMap < K , V > . Segment getSegment ( int index ) { } protected ConcurrentReferenceHashMap < K , V > . ReferenceManager createReferenceManager ( ) { } protected int getHash ( Object o ) { } @ Override public V get ( Object key ) { } @ Override public boolean containsKey ( Object key ) { } protected final ConcurrentReferenceHashMap . Reference < K , V > getReference ( Object key , ConcurrentReferenceHashMap . Restructure restructure ) { } @ Override public V put ( K key , V value ) { } @ Override public V putIfAbsent ( K key , V value ) { } private V put ( final K key , final V value , final boolean overwriteExisting ) { } @ Override public V remove ( Object key ) { } @ Override public boolean remove ( Object key , final Object value ) { } @ Override public boolean replace ( K key , final V oldValue , final V newValue ) { } @ Override public V replace ( K key , final V value ) { } @ Override public void clear ( ) { } public void purgeUnreferencedEntries ( ) { } @ Override public int size ( ) { } @ Override public Set < Map . Entry < K , V > > entrySet ( ) { } private < T > T doTask ( Object key , ConcurrentReferenceHashMap < K , V > . Task < T > task ) { } private ConcurrentReferenceHashMap < K , V > . Segment getSegmentForHash ( int hash ) { } protected static int calculateShift ( int minimumValue , int maximumValue ) { int shift = 0 ; int value = 1 ; <START_BUG> while ( ( value < minimumValue ) && ( value < minimumValue ) ) { <END_BUG> value <<= 1 ; shift ++ ; } return shift ; } public static enum ReferenceType { SOFT , WEAK ; } @ SuppressWarnings ( "serial" ) protected final class Segment extends ReentrantLock { private final ConcurrentReferenceHashMap < K , V > . ReferenceManager referenceManager ; private final int initialSize ; private volatile ConcurrentReferenceHashMap . Reference < K , V > [ ] references ; private volatile int count = 0 ; private int resizeThreshold ; public Segment ( int initialCapacity ) { } public ConcurrentReferenceHashMap . Reference < K , V > getReference ( Object key , int hash , ConcurrentReferenceHashMap . Restructure restructure ) { } public < T > T doTask ( final int hash , final Object key , final ConcurrentReferenceHashMap < K , V > . Task < T > task ) { } public void clear ( ) { } protected final void restructureIfNecessary ( boolean allowResize ) { } private ConcurrentReferenceHashMap . Reference < K , V > findInChain ( ConcurrentReferenceHashMap . Reference < K , V > reference , Object key , int hash ) { } @ SuppressWarnings ( "unchecked" ) private ConcurrentReferenceHashMap . Reference < K , V > [ ] createReferenceArray ( int size ) { } private int getIndex ( int hash , ConcurrentReferenceHashMap . Reference < K , V > [ ] references ) { } private void setReferences ( ConcurrentReferenceHashMap . Reference < K , V > [ ] references ) { } public final int getSize ( ) { } public final int getCount ( ) { } } protected static interface Reference < K , V > { ConcurrentReferenceHashMap . Entry < K , V > get ( ) { } int getHash ( ) { } ConcurrentReferenceHashMap . Reference < K , V > getNext ( ) { } void release ( ) { } } protected static final class Entry < K , V > implements Map . Entry < K , V > { private final K key ; private volatile V value ; public Entry ( K key , V value ) { } @ Override public K getKey ( ) { } @ Override public V getValue ( ) { } @ Override public V setValue ( V value ) { } @ Override public String toString ( ) { } @ Override @ SuppressWarnings ( "rawtypes" ) public final boolean equals ( Object o ) { } @ Override public final int hashCode ( ) { } } private abstract class Task < T > { private final EnumSet < ConcurrentReferenceHashMap . TaskOption > options ; public Task ( ConcurrentReferenceHashMap . TaskOption ... options ) { }

Fix:
while ( ( value < minimumValue ) && ( value < maximumValue ) ) {