I have an array list (below). The numbers of the list's equivalent char representation print out a secret message (which can be done through type casting). But before I read that, I need to add 5 to each element in the array list first. But I thought as the array is final that we could not change the string elements? (I did try making the array non-final, but still could not increment each value in the list by 5.) You can see the code I have tried to use below, but it still prints out the original values in the list. Does anyone have any pointers? thanks.
public static void main(String[] args) {
final int[] message = { 82, 96, 103, 103, 27, 95, 106, 105, 96, 28 };
final int key = 5;
for (int x : message)
x = x + key;
for (int x : message)
System.out.print(x + ",");
}