public static void shiftLeft ( final byte [ ] src , final int bits , final byte [ ] dst ) { final int bitPart = bits % 8 ; final int bytePart = bits / 8 ; for ( int i = 0 ; i < dst . length ; i ++ ) { final int a = i + bytePart ; if ( a >= 0 && src . length > a ) { dst [ i ] |= ( byte ) ( ( src [ a ] & 0xFF ) << bitPart & 0xFF ) ; } final int b = i + bytePart + 1 ; if ( b >= 0 && src . length > b ) { dst [ i ] |= ( byte ) ( ( src [ b ] & 0xFF ) >> 8 - bitPart & 0xFF ) ; } } }
Shift left .