question: public void testIntConversionAndOrdering ( ) throws Exception { BytesRef previous = null ; BytesRef current = new BytesRef ( new byte [ Integer . BYTES ] ) ; for ( int value = - 100000 ; value < 100000 ; value ++ ) { NumericUtils . intToSortableBytes ( value , current . bytes , current . offset ) ; if ( previous == null ) { previous = new BytesRef ( new byte [ Integer . BYTES ] ) ; } else { assertTrue ( "current bigger than previous: " , previous . compareTo ( current ) < 0 ) ; } assertEquals ( "forward and back conversion should generate same int" , value , NumericUtils . sortableBytesToInt ( current . bytes , current . offset ) ) ; System . arraycopy ( current . bytes , current . offset , previous . bytes , previous . offset , current . length ) ; } }
target:  generate a series of encoded ints, each numerical one bigger than the one before. check for correct ordering of the encoded bytes and that values round-trip.