private static long [ ] transformCountsToOffsets ( long [ ] counts , long numRecords , long outputOffset , long bytesPerRecord , boolean desc , boolean signed ) { assert counts . length == 256 ; int start = signed ? 128 : 0 ; // output the negative records first (values 129-255). if ( desc ) { long pos = numRecords ; for ( int i = start ; i < start + 256 ; i ++ ) { pos -= counts [ i & 0xff ] ; counts [ i & 0xff ] = outputOffset + pos * bytesPerRecord ; } } else { long pos = 0 ; for ( int i = start ; i < start + 256 ; i ++ ) { long tmp = counts [ i & 0xff ] ; counts [ i & 0xff ] = outputOffset + pos * bytesPerRecord ; pos += tmp ; } } return counts ; }
Transforms counts into the proper unsafe output offsets for the sort type .