question: public Histogram ( int [ ] [ ] matrix ) { matrix = normalizeMatrix ( matrix ) ; this . matrix = matrix ; int length = 0 ; int weight = 0 ; for ( int i = 0 ; i < matrix . length ; i ++ ) { int rowLength = matrix [ i ] . length - 1 ; length += rowLength ; weight += matrix [ i ] [ 0 ] * rowLength ; } this . totalWeight = weight ; long [ ] hist2col = new long [ length ] ; int fillp = 0 ; for ( int i = 0 ; i < matrix . length ; i ++ ) { for ( int j = 1 ; j < matrix [ i ] . length ; j ++ ) { hist2col [ fillp ++ ] = ( ( long ) matrix [ i ] [ j ] << 32 ) | ( LOW32 & matrix [ i ] [ 0 ] ) ; } } assert ( fillp == hist2col . length ) ; Arrays . sort ( hist2col ) ; int [ ] [ ] table = makeTable ( hist2col ) ; values = table [ 1 ] ; counts = table [ 0 ] ; assert ( assertWellFormed ( null ) ) ; }
target:  Build a histogram given a compact matrix of counts and values. 