title: java xor over a single byte with a byte[] size key
body: <p>I want to apply xor on each byte separately and store them in a specific byte in a certain memory location.</p>
  
  <p>For example I have a string "0", I'm converting it to ASCII and then need to apply xor on it with a multi-byte key e.g "243", the resulting data must be in a single byte. Is this even possible?</p>
  
  <pre><code>private byte[] xorWithKey(byte[] a, byte[] key) {
      byte[] out = new byte[a.length];
      for (int i = 0; i &lt; a.length; i++) {
          out[i] = (byte) (a[i] ^ key[i%key.length]);
      }
      return out;
  }
  </code></pre>
  
  <p>Right now I'm using this snippet which takes bytes array and returns a byte array, this is working fine, but I want to achieve this on a single byte like:</p>
  
  <pre><code>private byte xorWithKey(byte a, byte[] key)
  </code></pre>