Arrays useful methods:
Sum of Columns in a jagged array
public static int addColumn(int[][] arr, int x){
int columnSum = 0;
int i = 0;
int j = 0;
int numRows = [Link];
//add column values to find sum
while( i < numRows ){
if( x < arr[i].length ){
columnSum += arr[i][x];
}
++i;
}
return columnSum;
Fill a 2D array with a certain value
fill(double[] a, double val)
Assigns the specified double value to each element of the specified array of doubles.
//other variances of fill method to fill, int, etc and even objects/obj references/ fill in only for a
certain range etc.
public Matrix(int r, int c, double fillIn){
element=new double [r][r];
for (double[] arr: element){
[Link](arr, fillIn);
}
}