I am trying to get values from a 1d array into a 2d array, but skipping over values I don't want. In a previous method, i turned invalid values into -1s the the 1d array dimtoke, now I am trying to fill my 2d array, called dimensions, and trying to skip the invalid -1 and continue filling the array with the next valid value.
.
// Taking valid line segments and putting them in 2d array.
dimensions = new int[countLines][4];
for (int i = 0; i < dimensions.length; i++) {
for (int j = 0; j < dimensions[0].length; j++) {
if(dimtoke[n] != -1){
dimensions[i][j] = dimtoke[n];
n++;
}
else
n++;
}
}
my problem is that instead of filling the 2d array with the next valid value, it fills a 0 where i need my next value.
jin the else statement