// Collection of code snippets by Arne VajhÃ¸j 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
public class EncDec {
   public static String encrypt(String s, int key) {
      StringBuffer sb = new StringBuffer("");
      for(int i = 0; i < s.length(); i++) {
         sb.append((char)(s.charAt(i) + key));
      }
      return sb.toString();

   }
   public static String decrypt(String s, int key) {
      StringBuffer sb = new StringBuffer("");
      for(int i = 0; i < s.length(); i++) {
         sb.append((char)(s.charAt(i) - key));
      }
      return sb.toString();

   }
   public static void main(String[] args) {
      System.out.println(encrypt("ABCÆØÅ", 3));
      System.out.println(decrypt("DEFÉÛÈ", 3));
   }
}
