Advertisement
Guest User

Untitled

a guest
Sep 29th, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. public class Cypher
  2. {
  3. public static void main(String[] args)
  4. {
  5. String inputText = "THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG";
  6. int cypherKey = 10;
  7. int startOffset = (int) 'A';
  8.  
  9. for (int i = 0; i < inputText.length(); i++)
  10. {
  11. int character = (int) inputText.charAt(i);
  12.  
  13. if (character != (int) ' ')
  14. {
  15. character = ((character - startOffset) + cypherKey) % 26 + startOffset;
  16. }
  17.  
  18. System.out.print((char) character);
  19. }
  20.  
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement