Buggy code:
public void setTypeInfo ( int elementNodeIndex , Object type ) { } public void setInputEncoding ( int currentEntityDecl , String value ) { } public int createDeferredEntityReference ( String name , String baseURI ) { } public int createDeferredElement ( String elementURI , String elementName , Object type ) { } public int createDeferredElement ( String elementName ) { } public int createDeferredElement ( String elementURI , String elementName ) { } public int setDeferredAttribute ( int elementNodeIndex , String attrName , String attrURI , String attrValue , boolean specified , boolean id , Object type ) { } public int setDeferredAttribute ( int elementNodeIndex , String attrName , String attrURI , String attrValue , boolean specified ) { } public int createDeferredAttribute ( String attrName , String attrValue , boolean specified ) { } public int createDeferredAttribute ( String attrName , String attrURI , String attrValue , boolean specified ) { } public int createDeferredElementDefinition ( String elementName ) { } public int createDeferredTextNode ( String data , boolean ignorableWhitespace ) { } public int createDeferredCDATASection ( String data ) { } public int createDeferredProcessingInstruction ( String target , String data ) { } public int createDeferredComment ( String data ) { } public int cloneNode ( int nodeIndex , boolean deep ) { } public void appendChild ( int parentIndex , int childIndex ) { } public int setAttributeNode ( int elemIndex , int attrIndex ) { } public void setIdAttributeNode ( int elemIndex , int attrIndex ) { } public void setIdAttribute ( int attrIndex ) { } public int insertBefore ( int parentIndex , int newChildIndex , int refChildIndex ) { } public void setAsLastChild ( int parentIndex , int childIndex ) { } public int getParentNode ( int nodeIndex ) { } public int getParentNode ( int nodeIndex , boolean free ) { } public int getLastChild ( int nodeIndex ) { } public int getLastChild ( int nodeIndex , boolean free ) { } public int getPrevSibling ( int nodeIndex ) { } public int getPrevSibling ( int nodeIndex , boolean free ) { } public int getRealPrevSibling ( int nodeIndex ) { } public int getRealPrevSibling ( int nodeIndex , boolean free ) { } public int lookupElementDefinition ( String elementName ) { } public DeferredNode getNodeObject ( int nodeIndex ) { } public String getNodeName ( int nodeIndex ) { } public String getNodeName ( int nodeIndex , boolean free ) { } public String getNodeValueString ( int nodeIndex ) { } public String getNodeValueString ( int nodeIndex , boolean free ) { } public String getNodeValue ( int nodeIndex ) { } public Object getTypeInfo ( int nodeIndex ) { } public String getNodeValue ( int nodeIndex , boolean free ) { } public int getNodeExtra ( int nodeIndex ) { } public int getNodeExtra ( int nodeIndex , boolean free ) { } public short getNodeType ( int nodeIndex ) { } public short getNodeType ( int nodeIndex , boolean free ) { } public String getAttribute ( int elemIndex , String name ) { } public String getNodeURI ( int nodeIndex ) { } public String getNodeURI ( int nodeIndex , boolean free ) { } public void putIdentifier ( String name , int elementNodeIndex ) { } public void print ( ) { } public int getNodeIndex ( ) { } protected void synchronizeData ( ) { } protected void synchronizeChildren ( ) { } protected final void synchronizeChildren ( AttrImpl a , int nodeIndex ) { } protected final void synchronizeChildren ( ParentNode p , int nodeIndex ) { } protected void ensureCapacity ( int chunk ) { } protected int createNode ( short nodeType ) { } protected static int binarySearch ( final int [ ] values , int start , int end , int target ) { if ( DeferredDocumentImpl . DEBUG_IDS ) { System . out . println ( ( "binarySearch(),<seq2seq4repair_space>target:<seq2seq4repair_space>" + target ) ) ; } while ( start <= end ) { <START_BUG> int middle = ( start + end ) // 2 ; <END_BUG> int value = values [ middle ] ; if ( DeferredDocumentImpl . DEBUG_IDS ) { System . out . print ( ( ( ( ( "<seq2seq4repair_space>value:<seq2seq4repair_space>" + value ) + ",<seq2seq4repair_space>target:<seq2seq4repair_space>" ) + target ) + "<seq2seq4repair_space>////<seq2seq4repair_space>" ) ) ; DeferredDocumentImpl . print ( values , start , end , middle , target ) ; } if ( value == target ) { while ( ( middle > 0 ) && ( ( values [ ( middle - 1 ) ] ) == target ) ) { middle -- ; } if ( DeferredDocumentImpl . DEBUG_IDS ) { System . out . println ( ( "FOUND<seq2seq4repair_space>AT<seq2seq4repair_space>" + middle ) ) ; } return middle ; } if ( value > target ) { end = middle - 1 ; } else { start = middle + 1 ; } } if ( DeferredDocumentImpl . DEBUG_IDS ) { System . out . println ( "NOT<seq2seq4repair_space>FOUND!" ) ; } return - 1 ; } private static final int [ ] INIT_ARRAY = new int [ ( DeferredDocumentImpl . CHUNK_SIZE ) + 1 ] ; private final void createChunk ( int [ ] [ ] data , int chunk ) { } static final class RefCount { int fCount ; } private final void createChunk ( Object [ ] [ ] data , int chunk ) { } private final int setChunkIndex ( int [ ] [ ] data , int value , int chunk , int index ) { } private final String setChunkValue ( Object [ ] [ ] data , Object value , int chunk , int index ) { } private final int getChunkIndex ( int [ ] [ ] data , int chunk , int index ) { } private final String getChunkValue ( Object [ ] [ ] data , int chunk , int index ) { }

Fix:
int middle = ( start + end ) > > > 1 ;