int e = ( a & b << 2 ) | ( c & ( d >>> 1 ) ); // if you trust precedence can be written more tersely: int e = a & b << 2 | c & d >>> 1;