Pastebin is 300% more awesome when you are logged in. Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 26th, 2013  |  syntax: Java  |  size: 0.54 KB  |  hits: 31  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. public class M3L1T1
  2. {
  3.     public static void main (String[] args) {
  4.         System.out.println(encodeString("sigh"));
  5.     }
  6.    
  7.     public static String encodeString (String input) {
  8.     int index = 0;
  9.     String output = "";
  10.     while (index < output.length()) {
  11.         output = output + (char) (output.charAt(index) + 13);
  12.         int forWrap = forWrap + (char) (forWrap.charAt(index));
  13.         index++;
  14.     }
  15.     if (forWrap > 26) {
  16.         output = output + (char) (output.charAt(index) - 13);
  17.     }
  18.     return output;
  19.     }
  20. }