title: caesar shift cipher java
body: <p>I'm trying to implement a basic Caesar Shift Cipher for Java to shift all the letters by 13. Here's my code so far.</p>
  
  <pre><code>    public static String cipher(String sentence){
      String s = "";
      for(int i = 0; i &lt; sentence.length(); i++){
          char c = (char)(sentence.charAt(i) + 13);
          if (c &gt; 'z')
              s += (char)(sentence.charAt(i) - 13);
          else
              s += (char)(sentence.charAt(i) + 13);
      }
      return s;
  }
  </code></pre>
  
  <p>However, the program also changes the values of numbers and special characters and I don't want that. </p>
  
  <pre><code>String sentence = "abc123";
  </code></pre>
  
  <p>returns "nop>?@"</p>
  
  <p>Is there a simple way to avoid the special characters and only focus on letters?</p>
  
  <p>Edit: I should mention I want to keep all the other bits. So "abc123" would return "nop123".</p>