I am new to Java and I am having an issue with an array problem. I need to check the first digit in a String array and if it has a value of 0 or 9, I need to change it to a 1. Below is my code that is trying to do this. What I am having trouble with is populating the new array. Any help would be greatly appreciated.
for (int i = 0; i < nums.length; i++)
{
prinum[i] = nums[i].substring(5);
char[] temp = prinum[i].toCharArray();
for (int x = 0; x < prinum[i].length(); x++)
{
if (prinum[i].charAt(x) == '9')
{
temp[x] = 1;
}
else if (prinum[i].charAt(x) == '0')
{
temp[x] = 1;
}
}
String newprinum[i] = new String(temp);