Java tutorial
//package com.java2s; public class Main { public static String encode(String str) { return str + encodeChar(str); } private static char encodeChar(String str) { char value = 0; for (char d : str.toCharArray()) { value ^= d; } return value; } }