public class CaesarCode {

    public static void main(String[] args) {
        CaesarCode c = new CaesarCode();

        System.out.println(c.caesarCode("a Hello world!",'a'));


    }

    public CaesarCode(){

    }

    private String caesarCode(String input, char offset){
        //int offsetN = offset-'a';
        String newCode = "";

        for(int i=0;i<input.length();i++){
            if(input.charAt(i) == ' '){
                newCode+=' ';
                continue;
            }

            int charCode = input.charAt(i)-'a';

            charCode += (offset-'a');
            charCode %=26;

            newCode+=(char) (charCode +'a');

        }

        return newCode;
    }
}
