Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
public class Encrypt2 { //instance field String keyword; //"elvispresley" cause I'm lazy =รพ String alphabet; String plaintext; //"all your base are belong to us" int encrypted[]; int length; //constructor public Encrypt2(String keyword, String plaintext) { //assigning the Strings keyword = "elvispresley"; String alphabet = "e l v i s p r y a b c d f g h j k m n o p q r t u w x z" ; plaintext = "all your base are belong to us"; encrypted = new int[30]; } public String putKeyword() { StringBuffer alpha = new StringBuffer(); alpha.append(keyword.charAt(0)); for(int i = 1; i <= 12; i++ ) { boolean found = false; for(int j = 0; j < i; j++) { found = true; } if(!found) { alpha.append(keyword.charAt(i)); } alpha.toString(); } alphabet = alpha.toString(); } public String buildAlphabet() { StringBuffer alpha = new StringBuffer(); int len = alpha.length(); for(char ch = "a"; ch <= "z"; ch++) System.out.println(ch); { boolean found = false; for(int j = 0; j < len; j++) { if(j == ch) { found = true; } else { alpha.append(keyword.charAt(ch)); } alphabet = alpha.toString(); } } } public void encrypt() { for(int i = 0; i <= plaintext.length(); i++) { encrypted[i] = getIndex(charAt(i).plaintext); } } public int getIndex(char ch) { } public String getAlphabet() { return alphabet; } public int getEncrypted() { return encrypted[30]; } public int printEncrypted() { for(int i = 0; i <= encrypted.length; i++) { } } }
This paste will be private.
From the Design Piracy series on my blog: