caesar cipher java

Java
public static String incode(String strIn, int delta) {
        String strOut = "";

        // bring delta to positive value
        while (delta < 0) {
            delta += 26;
        }

        for (int i = 0; i < strIn.length(); i++) {
            char c = strIn.charAt(i);

            if (Character.isAlphabetic(c)) {
                char startLetter = Character.isUpperCase(c) ? 'A' : 'a';    // convert [a, z] to [0, 25]
                strOut += (char) ((c - startLetter + delta) % 26 + startLetter);
            } else {
                strOut += c;
            }
        }

        return strOut;
    }

public static String decode(String strIn, int delta) {
        return incode(strIn, -delta);
    }
Source

Also in Java: