SHARE
TWEET

Untitled

a guest Jan 26th, 2013 32 Never
  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. }
RAW Paste Data
Top