title: Keep Spaces, Punctuation, and char Cases in Java Caesar Cipher
body: <p>I'm trying to encrypt a txt file, but when i send my chars to array I lose my spaces. I want to keep my spaces along with punctuation and cases of letters. I am so close but cannot seem to do anything that doesn't make A.) everything a null character or B.) loop capital letters. Thanks in advance.</p>
  
  <pre><code>public class Encryption {
       CaesarCipher c= new CaesarCipher();
       Scanner kb = new Scanner(System.in);
       String end = "";
  
  public void changeLetters(File file) {
      System.out.println("How far would you like to shift?");
      int shift = Integer.parseInt(kb.nextLine());
      Scanner fileScanner;
      try {
          fileScanner = new Scanner(file);
          while (fileScanner.hasNextLine()) {
              String line = fileScanner.nextLine();
              shift(line, shift);
          }
      } catch (FileNotFoundException e) {
          e.printStackTrace();
      }
  }
  
  private void shift(String line, int shift) {
      char[] og = line.toCharArray();
      for (int i = 0; i &lt; og.length; i++) {
          char letter = og[i];
          letter = (char) (letter + shift);
          if (letter &gt; 'z') {
              letter = (char) (letter - 26);
          } else if (letter &lt; 'a') {
              letter = (char) (letter + 26);
          }
          end = end + Character.toString(letter);
      }
      System.out.println(end);
  
      File file = new File("Encrypted.txt");
      FileWriter writer = null;
  
      {
          try {
              writer = new FileWriter(file);
              writer.write(end);
              writer.close();
          } catch (
  
          IOException e)
  
          {
              e.printStackTrace();
          }
          System.out.println("Decryption Complete");
          System.out.println("Q to quit, C to Continue");
          String response = kb.next();
          if (response.equals("q") || response.equals("Q")) {
              System.out.println("Goodbye");
          } else if (response.equals("c") || response.equals("C")) {
              c.getInformation();
          }
      }
  }
  </code></pre>