swoop

Substitute methods

Dec 12th, 2011
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.42 KB | None | 0 0
  1.     public int substitute(int letter) {
  2.         if((letter - position) >= 0){
  3.             return this.mapping[letter-position] + position;
  4.         }
  5.         else{
  6.             return this.mapping[((letter-position) + 26)] + position;
  7.         }
  8.     }
  9.    
  10.     public int substituteBack(int letter){
  11.         if((letter - position) >= 0){
  12.             return inverseMapping[letter - position] + position;
  13.         }
  14.         else{
  15.             return inverseMapping[((letter - position) + 26)] + position;
  16.         }
  17.     }
Advertisement
Add Comment
Please, Sign In to add comment