code: public static void xor(ByteBuffer src, ByteBuffer dst, int mask) {
      	int remainder = src.remaining() % 4;
      	int remaining = src.remaining() - remainder;
      	int end = remaining + src.position();
  
      	// xor a 32bit word at a time as long as possible
      	while (src.position() < end) {
      		int masked = src.getInt() ^ mask;
      		dst.putInt(masked);
      	}
  
      	// xor the remaining 3, 2, or 1 bytes
      	byte b;
      	switch (remainder) {
      	case 3:
      		b = (byte) (src.get() ^ ((mask >> 24) & 0xff));
      		dst.put(b);
      		b = (byte) (src.get() ^ ((mask >> 16) & 0xff));
      		dst.put(b);
      		b = (byte) (src.get() ^ ((mask >> 8) & 0xff));
      		dst.put(b);
      		break;
      	case 2:
      		b = (byte) (src.get() ^ ((mask >> 24) & 0xff));
      		dst.put(b);
      		b = (byte) (src.get() ^ ((mask >> 16) & 0xff));
      		dst.put(b);
      		break;
      	case 1:
      		b = (byte) (src.get() ^ (mask >> 24));
      		dst.put(b);
      		break;
      	case 0:
  		default:
  			break;
      	}
      }
docs: Masks source buffer into destination buffer.
  
  @param src   the buffer containing readable bytes to be masked
  @param dst   the buffer where masked bytes are written
  @param mask  the mask to apply