Well, you asked for it, and I felt puzzled, but I printed the encryption text and you find out what you just asked for ...
public static String vigenereUNICODE(String plaintext, String key, boolean encrypt) { final int textSize = plaintext.length(); final int keySize = key.length(); final StringBuilder encryptedText = new StringBuilder(textSize); for (int i = 0; i < textSize; i++) { final int plainNR = plaintext.codePointAt(i); final int keyNR = key.codePointAt(i % keySize); final long cipherNR; if (encrypt) { cipherNR = ((long) plainNR + (long) keyNR) & 0xFFFFFFFFL; } else { cipherNR = ((long) plainNR - (long) keyNR) & 0xFFFFFFFFL; } encryptedText.appendCodePoint((int) cipherNR); } return encryptedText.toString(); }
EDIT: Please never use in production code, as I have no clue whether the codes can actually be encoded / decoded. As far as I know, not all points have been defined, but the standard is a moving target.
source share