Hi Guys!
I am currently developing the Tiny Encrytion Algorithm
Currenlty is takes in a number to encrytp and works fine but I want to ammend this so it takes in a string.
My current "get" method is as follows:
public void getNumber() {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int count = 0, idx = 0;
try {
String number = br.readLine();
while (count <= 1) {
num_array[count++] = Integer.parseInt(number.substring(idx, idx + 2));
idx += 2;
}
} catch (IOException ex) {
ex.printStackTrace();
} catch (NumberFormatException ex) {
ex.printStackTrace();
System.out.println("You have entered an invalid number");
}
}
How do I go about amending this to take in a String, but still cut it up and save it to an Integer array? (The integer array is required for the encrytion process at a later stage).
So in other words, i need to get from String to Integer, while cutting it up!!
I have played about with the charAt() and toBytes() method but i'm just going round in circles! :(
Cheers!!!
Edited by: smitty350z on Oct 31, 2007 4:49 AM