Advertisement
Guest User

Lrae's puzzle solution

a guest
Oct 24th, 2014
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.55 KB | None | 0 0
  1. public class numberLetterCounts {
  2.     public static void main(String[]args)  {
  3.        
  4.            
  5.             String encrypted = "tearsr svyeems# @#7aa%bee c";
  6.            
  7.             StringBuilder woodenDecrypt = new StringBuilder();
  8.             int vPlace = 0;
  9.             for(int p = 2700; p != 2727; p++) { //password has 27 different starting positions
  10.                 for(int i = 1; i != 29; i = (2667 + i)%64) { //goes through 20 iterations with
  11.                                                              //27 different inputs from p
  12.                     woodenDecrypt.append(encrypted.charAt((i + p)%27));  
  13.                 }                          //this tests all 27 permutations
  14.                 char v = '*';              //finds the 1 v in decrypted string
  15.                 int findV = 0;
  16.                 String hold = woodenDecrypt.toString();  //converts woodenDecrypt to string
  17.                 for(findV = 0, vPlace = 0; findV != 20; findV++) {  //finds the place of 'v'
  18.                     v = hold.charAt(findV);
  19.                     if(v == 'v')
  20.                     vPlace = findV;
  21.                 }
  22.                 if(vPlace <= 17) {   //if v is in the 18th or less position && '#' and 'r' follow after
  23.                     if((hold.charAt(1 + vPlace) == '#') && (hold.charAt(2 + vPlace) == 'r')) {
  24.                    
  25.                         hold = hold.replace("v#r", "ge");    //replacement will be made
  26.                         System.out.println(hold);            //print out iterations where 'v#r' is in order
  27.                    
  28.                     }
  29.                 }
  30.                 woodenDecrypt.delete(0, 20);  //reset stringbuilder variable so nothing is appended
  31.                                                    //between iterations
  32.             }
  33.            
  34.             String hashy = "mark", hey = "mark";
  35.             if((hashy.hashCode()) == hey.hashCode())
  36.             System.out.print("hashcodes are comparable.");
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement