Bite-Code™

Home » Post Item » Encryption: A character(alphabets) converts into numeric.

Encryption: A character(alphabets) converts into numeric.

March 1, 2010

//Use JCreator version 2.5.
//Acknowledgement to Mr. Alivn James Bellero, he help me to do this program. 

public class encryption{
public static void main(String args[])throws Exception{
  java.io.BufferedReader in;
  in = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
  
  String line=”";
  int num[] = new int[500];
  char letter[] = new char[500];
  int limit;
  int ctr=1;
  String arr[] = new String[500];  
System.out.print(”Enter limit: “);
line = in.readLine();
limit = Integer.parseInt(line);  

for(int i=1;i<=limit;i++){
  System.out.print(”Enter letter[” + (i) + “]: “);
  arr[i] = in.readLine();

  for(int x=1;x<=26;x++){
   num[x] = x;
  }
  for(char y=’a';y<=’z';y++){
   letter[ctr] = y;
   ctr++;
  } 
 for(int inp=1;inp<=limit;inp++){ 
  for(int traverse=1;traverse<=26;traverse++){
   if(arr[inp].charAt(0) == letter[traverse]){
    System.out.print(num[traverse] + ” “);
    }
   }
  }  
 }
}

Posted by mowllen at 10:30 am | permalink

All comments are moderated. Your comments will not appear here unless approved by the blog owner. Thank you.

Add a comment