title: How to write Logic for Affine Cipher Decryption in JAVA?
body: <p>Hello i m working on the affine cipher in JAVA. I have successfully written the code for Encryption but now i m not getting any idea about the logic for decryption.</p>
  
  <p>Below is my logic for encryption:</p>
  
  <pre><code>void encryption()
  {
      char character; 
      int plainTextLength=input.length();
      int a=1,b=2,c=3,d=4,e=5,f=6,g=7,h=8,i=9,j=10,k=11,l=12,m=13,n=14,
          o=15,p=16,q=17,r=18,s=19,t=20,u=21,v=22,w=23,x=24,y=25,z=26;
  
      System.out.print("Cipher text is:" );
  
      for (int in = 0; in &lt; plainTextLength; in++)
      {
          character = input.charAt(in);
  
          if (Character.isLetter(character))
          {
              character = (char)((firstKey*(character - 'a') + secondKey) % 26 + 'a');
          }
          System.out.print(character);
      }
      System.out.println();       
  }
  </code></pre>
  
  <p>This is my Encryption logic:
  character = (char)((firstKey*(character - 'a') + secondKey) % 26 + 'a');</p>
  
  <p>What would be the Decryption logic. I am totally confused ?</p>