Hi...
i am trying to run this program...and it stays that it does not have a main method...
public static void...
but i have the public static final int...
please let me know how i can get this program to run..thanks
public class CaesarCipher {
public static final int ALPHASIZE = 26;
public static final char [] alpha = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
protected char[] encrypt = new char[ALPHASIZE];
protected char[] decrypt = new char[ALPHASIZE];
public CaesarCipher() {
for (int i=0; i<ALPHASIZE; i++)
encrypt[i] = alpha[(i + 3) % ALPHASIZE];
for (int i=0; i<ALPHASIZE; i++)
decrypt[encrypt[i] - 'A'] = alpha[i];
}
/** Encryption Method */
public String encrypt(String secret) {
char[] mess = secret.toCharArray();
for (int i=0; i<mess.length; i++)
if (Character.isUpperCase(mess[i]))
mess[i] = encrypt[mess[i] - 'A'];
return new String(mess);
}
/** Decryption Method */
public String decrypt(String secret) {
char[] mess = secret.toCharArray();
for (int i=0; i<mess.length; i++)
if (Character.isUpperCase(mess[i]))
mess[i] = decrypt[mess[i] - 'A'];
return new String(mess);
}
}