// 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 Caesar {
        public static void main(String[] args) {
                String s = "hej";
                System.out.println(encrypt(s));
                System.out.println(decrypt(s));
                System.out.println(decrypt(encrypt(s)));
                System.out.println(encrypt(decrypt(s)));
        }
        public static String encrypt(String s) {
                StringBuffer sb = new StringBuffer(s);
                for(int i = 0; i < sb.length(); i++) {
                        sb.setCharAt(i, (char)(byte)(sb.charAt(i) + 5));
                }
                return sb.toString();
        }
        public static String decrypt(String s) {
                StringBuffer sb = new StringBuffer(s);
                for(int i = 0; i < sb.length(); i++) {
                        sb.setCharAt(i, (char)(byte)(sb.charAt(i) - 5));
                }
                return sb.toString();
        }
}
