So I have this method
For some reason the line in bold doesn't seem to do anything, the string is returned empty, yet system.print prints out all the numbers correctly.
Code:
public String encrypt(String message, int key) throws java.rmi.RemoteException {
char[] charArray = message.toCharArray();
int[] numberArray = new int[message.length()];
int number;
String data = "";
for(int i = 0; i < message.length(); i++) {
numberArray[i] = charArray[i];
}
for (int i = 0; i < numberArray.length; i++) {
if (numberArray[i] < 123 && numberArray[i] > 96) {
if (numberArray[i] < 120) {
numberArray[i] += 3;
} else {
numberArray[i] += 3 - 26;
}
} else if (numberArray[i] < 91 && numberArray[i] > 64) {
if (numberArray[i] < 88) {
numberArray[i] += 3;
} else {
numberArray[i] += 3 - 26;
}
}
}
charArray = Integer.toString(key).toCharArray();
for (int x = 0; x < numberArray.length; x++) {
numberArray[x] -= charArray[x % charArray.length];
}
for (int x = 0; x < numberArray.length - 1; x += 2) {
number = numberArray[x];
numberArray[x] = numberArray[x + 1];
numberArray[x + 1] = number;
}
for(int x = 0; x < numberArray.length; x++) {
[b]data.concat(Integer.toString(numberArray[x]));[/b]
}
return data;
}
For some reason the line in bold doesn't seem to do anything, the string is returned empty, yet system.print prints out all the numbers correctly.