Simply put this program is merging two arrays containing coordinates into one larger array, the only issue is within my arrays there are lots of [0][0] values, I’m simply trying to count the number of coordinate pairs that are NOT 0 , 0
counter = 0;
int merged[][] = new int[lupper.length + llower.length][COLUMNS];
for (int i=0; i<ROWS; i++){
merged[i][0] = lupper[i][0];
merged[i][1] = lupper[i][1];
for (int j=lupper.length; j<ROWS; j++){
merged[j][0] = llower[j][0];
merged[j][1] = llower[j][1];
}
}
for ( int i=0; i<merged.length; i++){
if (merged[i][0] == merged[0][0]){
counter = counter++;
}
if (merged[i][1] == merged[0][0]){
counter = counter++;
}
}
Why does the counter returns as 0 continuously?
You have in your code:
It does not increment the value of
counter. You can instead try: