Slice byte-stream into bit pieces
Note: This is an answer that OP originally edited into his question.



I gather the data into an array of bytes data[125].

Then I gather the relevant bytes per value and stack them together:

long var = (data[4]&lt;&lt;8) + (data[3]);


I shift them so the relevant bytes start first

var=var&gt;&gt;3;


Afterwards I mask them with the RIGHT mask

var=var &amp; 0xFF;


For the example in my question:

long var = (data[1]&lt;&lt;8) + (data[0]); // I need two bytes  
var=var&gt;&gt;1; // shift them to the right one bit  
var=var &amp; 0x7FFF; // mask it with "0111 1111 1111 1111"