title: Java, How to implement a Shift Cipher (Caesar Cipher)
body: <p>I want to implement a Caesar Cipher shift to increase each letter in a string by 3.  </p>
  
  <p>I am receiving this error: </p>
  
  <pre><code>possible loss of precision required char; found int
  </code></pre>
  
  <p>Here is my code so far:</p>
  
  <pre><code>import java.util.Scanner;
  import java.io.*;
  
  public class CaesarCipher
  {
      public static void main (String [] args) {
  
          char[] letters = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 
              'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 
              'w', 'x', 'y', 'z'};
  
          char[] message = "onceuponatime".toCharArray();
          char[] eMessage = new char[message.length];
          char shift = 3;
  
          //encrypting message
          for(int i = 0; i &lt;= message.length; ++i)
          {
              eMessage[i] = (message[i] + shift) % (char) letters.length;
              System.out.println(x);               
          }              
      }
  }
  </code></pre>
  
  <p>What causes this error?  How can I implement a caesar Cipher shift to increase each letter in a string by 3?</p>