title: How to Encrypt a Message With an Encryption Key
body: <p>I'm attempting to write a small encryption program. One of the options is "encrypt with key". The thing I can't figure out is how to create a way to encrypt a message based on a String.</p>
  
  <pre><code>public static void encodeWithKey(){
      System.out.println("What is the encryption key?");
      String encryptKey = scan.nextLine();
  
      System.out.println("What is the message to encrypt?");
      String messageWithKey = scan.nextLine();
  
      StringBuilder encryptWithKeyBuilder = new StringBuilder();
  
      for (char c : messageWithKey.toCharArray()) {
        // Add 1 to each character and append it
        encryptWithKeyBuilder.append((char) (c - 1));
      }
  
      // Now the builder contains the String with the shifted values
      System.out.println("Your encoded message is: ");
      System.out.print(encryptWithKeyBuilder);
  
  }
  </code></pre>
  
  <p>I want to find the first two letters of their encrypt key, convert them to integers, and add them together. Then use that to encrypt the message (in the for loop, replacing the '1' with the new number.)</p>