// tableSize = 1 << 3 = 8 in my case
public void initialize(short[] normalizedCounts, int maxSymbol, int tableLog)
    {
        int tableSize = 1 << tableLog;
        // tableSize = 1 << 3 = 8 in my case
        byte[] table = new byte[tableSize]; // TODO: allocate in workspace
        // store the symbol which is spread
        int highThreshold = tableSize - 1;
        // highThreshold = 8 - 1 = 7 in my case
        // TODO: make sure FseCompressionTable has enough size
        log2Size = tableLog;
        // For explanations on how to distribute symbol values over the table:
        // http://fastcompression.blogspot.fr/2014/02/fse-distributing-symbol-values.html
        // symbol start positions
        int[] cumulative = new int[MAX_SYMBOL + 2]; // TODO: allocate in workspace
        // cumulative = [0,3,6,8,9] in my case
        // store the start position of every symbol
        cumulative[0] = 0;
        for (int i = 1; i <= maxSymbol + 1; i++) {
            if (normalizedCounts[i - 1] == -1) {  
                // Low probability symbol
                cumulative[i] = cumulative[i - 1] + 1;
                table[highThreshold--] = (byte) (i - 1);
            }
            else {
                cumulative[i] = cumulative[i - 1] + normalizedCounts[i - 1];
            }
        }
        cumulative[maxSymbol + 1] = tableSize + 1;
        // cumulative[3+1] = 8+1 = 9
        // Spread symbols
        int position = spreadSymbols(normalizedCounts, maxSymbol, tableSize, highThreshold, table);
        // make sure the symbols are successfully spread
        if (position != 0) {
            throw new AssertionError("Spread symbols failed");
        }
        // Build table
        // fill in CTable1
        for (int i = 0; i < tableSize; i++) {
            byte symbol = table[i];
            nextState[cumulative[symbol]++] = (short) (tableSize + i);  /* TableU16 : sorted by symbol order; gives next state value */
        }
        // Build symbol transformation table
        // fill in SymbolTT
        int total = 0;
        for (int symbol = 0; symbol <= maxSymbol; symbol++) {
            switch (normalizedCounts[symbol]) {
                case 0:
                    deltaNumberOfBits[symbol] = ((tableLog + 1) << 16) - tableSize;
                    break;
                case -1:
                case 1:
                    deltaNumberOfBits[symbol] = (tableLog << 16) - tableSize;
                    deltaFindState[symbol] = total - 1;
                    total++;
                    break;
                default:
                    int maxBitsOut = tableLog - Util.highestBit(normalizedCounts[symbol] - 1);
                    int minStatePlus = normalizedCounts[symbol] << maxBitsOut;
                    deltaNumberOfBits[symbol] = (maxBitsOut << 16) - minStatePlus;
                    deltaFindState[symbol] = total - normalizedCounts[symbol];
                    total += normalizedCounts[symbol];
                    break;
            }
        }
    }
{
int tableSize = 1 << tableLog;
// tableSize = 1 << 3 = 8 in my case
byte[] table = new byte[tableSize]; // TODO: allocate in workspace
// store the symbol which is spread
public void initialize(short[] normalizedCounts, int maxSymbol, int tableLog)
{
int tableSize = 1 << tableLog;
// tableSize = 1 << 3 = 8 in my case
byte[] table = new byte[tableSize]; // TODO: allocate in workspace
// store the symbol which is spread
int highThreshold = tableSize - 1;
// highThreshold = 8 - 1 = 7 in my case
// TODO: make sure FseCompressionTable has enough size
log2Size = tableLog;
// For explanations on how to distribute symbol values over the table:
// http://fastcompression.blogspot.fr/2014/02/fse-distributing-symbol-values.html
// symbol start positions
int[] cumulative = new int[MAX_SYMBOL + 2]; // TODO: allocate in workspace
public void initialize(short[] normalizedCounts, int maxSymbol, int tableLog)
{
int tableSize = 1 << tableLog;
// tableSize = 1 << 3 = 8 in my case
byte[] table = new byte[tableSize]; // TODO: allocate in workspace
// store the symbol which is spread
int highThreshold = tableSize - 1;
// highThreshold = 8 - 1 = 7 in my case
// TODO: make sure FseCompressionTable has enough size
log2Size = tableLog;
// For explanations on how to distribute symbol values over the table:
// http://fastcompression.blogspot.fr/2014/02/fse-distributing-symbol-values.html
// symbol start positions
int[] cumulative = new int[MAX_SYMBOL + 2]; // TODO: allocate in workspace
// cumulative = [0,3,6,8,9] in my case
// store the start position of every symbol
cumulative[0] = 0;
for (int i = 1; i <= maxSymbol + 1; i++) {
if (normalizedCounts[i - 1] == -1) {
// Low probability symbol
cumulative[i] = cumulative[i - 1] + 1;
table[highThreshold--] = (byte) (i - 1);
}
else {