adding 2d arrays together
in
Programming Questions
•
2 years ago
hi guys,
i have a set of 2d arrays which i've stored in an arraylist. How do i combine the 2d arrays?
the script is a bit lengthy so i dont want to post the whole thing up...
- //xs is the int[][] arraylist
- //finalSum is a variable stored in the class
- for(int i=0;i<xs.size();i++){
- int valval[][] = new int[imgwidth][imgheight];
- valval = xs.get(i);
- for(int j=0;j<imgwidth;j++){
- for(int k=0;k<imgheight;k++){
- finalSum[j][k] = finalSum[j][k] + valval[j][k];
- }
- }
- }
1