title: Java Ceaser Cipher program not working properly
body: <p>My program is supposed to print out a string, but instead, it prints out 100, for each lowercase letter, and 68 for each upper case letter, in the user input message. </p>
  
  <p>Anything positive and constructive that can be said about the code to help my program work, or to make my program better would be highly appreciated.</p>
  
  <p>I think my error is either in my main, or calcOffset. </p>
  
  <p>Thanks.</p>
  
  <pre><code> import java.util.Scanner;
  
  class CeaserCipher{
  
      char[] Alphabet = {'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'};
  
      public static void main(String[] args){
          String in;
          int off;
  
  
          Scanner sc = new Scanner (System.in);
  
          System.out.println("Message: ");
          in = sc.nextLine();
  
          System.out.println("Offset: ");
          off = sc.nextInt();
  
          String out = new CeaserCipher().ceaser(in, off);
  
          System.out.println(out);
  
      }
  
      public String ceaser(String in, int off){
  
          char[] useMe = in.toCharArray();
  
          String output = " ";
  
          for(int j=0; j!=useMe.length; j++){
              if(Character.isUpperCase(useMe[j]))
                  output += Character.toUpperCase(calcOffset(getIndex(useMe[j]), off));
              else
                  output += calcOffset(getIndex(useMe[j]), off);
          }
          return output;
      }
      public int getIndex(char letter){
  
          if (Character.isUpperCase(letter)){
              letter = Character.toLowerCase(letter);
          }
          for (int i = 0; i != Alphabet.length; i++){
                  return i;
              }
              return 999;
          }
  
      public int calcOffset(int index, int off){
  
          if((index + off) &lt; 0){
              int newIndex = 26 + (index+off);
  
              return Alphabet[newIndex];
          }
          if((index + off) &gt; 25){
              int newIndex = (index+off) - 26;
  
              return Alphabet[newIndex];
          }
          if((index + off) &gt;= 0 &amp;&amp; (index + off) &lt; 25){
              int newIndex = (index + off);
  
              return Alphabet[newIndex];
       }
  
       return 'X';
      }
  
    }
  </code></pre>