There are a few steps to this:
- convert the String to characters: either use String.toCharArray() or String.charAt(int) and String.length()
- convert each char into a number. Oh wait, char already is numeric! 't' is the same as (char)104.
- perform xor on each number. The operator is ^.
So in pseudo code:
This will only work for characters that need only one byte, i.e. the ASCII characters (0-127). For others c will be need more than 8 bits to represent itself. You can use a bitwise AND to chop off everything after the first 8 bits: I wrote down 127 here to indicate it is the maximum value of an ASCII character / byte. You will also often see 0x7F (hexadecimal) but that's the same.