Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. public boolean toggleEncryption(){
  2. if(encrypted == false){
  3. for(int i = 0; i < sentence.length(); i++){
  4. if(sentence.charAt(i) >= 65 && sentence.charAt(i) <= 90){
  5. int x = (int)sentence.charAt(i);
  6. x += key;
  7. while(x > 90){
  8. x = x - 26;
  9. }
  10. sentence.charAt(i) += (char)x;
  11. }
  12. }
  13. }
  14. return encrypted;
  15. }
  16.  
  17. sentence.charAt(i) += (char)x;
  18.  
  19. char c = 'a';
  20. c += 'b';
  21.  
  22. StringBuilder builder = new StringBuilder(sentence.length());
  23. for(int i = 0; i < sentence.length(); i++) {
  24. if(sentence.charAt(i) >= 65 && sentence.charAt(i) <= 90){
  25. int x = (int)sentence.charAt(i);
  26. x += key;
  27. while(x > 90){
  28. x = x - 26;
  29. }
  30. builder.append(sentence.charAt(i) + (char)x));
  31. } else {
  32. builder.append(sentence.charAt(i));
  33. }
  34. }
  35.  
  36. sentence.charAt(i) += (char)x;
  37.  
  38. char tempChar = sentence.charAt(i);
  39.  
  40. tempChar += (char)x;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement