private int SumWeights(short[,] weights) { int sum=0; for(int i=0;i<weights.GetLength(0); i++) for(int j=0;j<weights.GetLength(1);j++) sum+=weights[i,j]; return sum; }