Skip to content

Instantly share code, notes, and snippets.

Created February 12, 2013 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4773175 to your computer and use it in GitHub Desktop.
Save anonymous/4773175 to your computer and use it in GitHub Desktop.
import java.util.*;
public class Cipher {
//Array list for the words that have been ciphered
static ArrayList<String> cipherWordsDone = new ArrayList<String>();
static String randomString;
static char randomChar;
public static void main(String[] args){
//String array for the cipher words
String[] cipherWords = new String[args.length];
//loop to add the command line words to the string array
for(int i = 0;i<args.length;i++){
cipherWords[i] = args[i];
}
//create cipher
Cipher cipher = new Cipher(cipherWords);
//print out the newly coded words
System.out.println(cipherWordsDone);
}
public Cipher(String[] s){
for(int i = 0;i<s.length;i++){
for(int j = 0;j<s[i].length();j++){
if(s[i].charAt(j)<91){
randomChar = 155 - s[i].charAt(j);
}
else if(s[i].charAt(j)<123){
randomChar = 219 - s[i].charAt(j);
}
else{
randomChar = ' ';
}
}
randomString
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment