Here you can find the source of unpack(int[] sourcearray, int arraypos, int[] data, int datapos, int num, int b)
protected static int unpack(int[] sourcearray, int arraypos, int[] data, int datapos, int num, int b)
//package com.java2s; /**//from w w w. ja v a 2 s .c o m * This code is released under the * Apache License Version 2.0 http://www.apache.org/licenses/. * * (c) Daniel Lemire, http://lemire.me/en/ */ public class Main { protected static int unpack(int[] sourcearray, int arraypos, int[] data, int datapos, int num, int b) { if (b > 16) { System.arraycopy(sourcearray, arraypos, data, 0, num); return num + arraypos; } final int mask = (1 << b) - 1; int inwordpointer = 0; for (int k = 0; k < num; ++k) { data[k + datapos] = ((sourcearray[arraypos] >>> inwordpointer) & mask); inwordpointer += b; final int increment = ((inwordpointer + b - 1) >> 5); arraypos += increment; inwordpointer &= ~(-increment); } return arraypos + (inwordpointer > 0 ? 1 : 0); } }