Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. public static void main(String[] args) {
  2.                
  3.   //z,x
  4.   int [][] matrix = new int[][]{{2,1},{3,4}};
  5.   int result = matrixCalculation(matrix);
  6.   System.out.println(result);
  7.                
  8. }
  9.  
  10. private static int matrixCalculation(int[][] matrix) {
  11.   int result = 0;
  12.   for(int i=0;i<matrix.length;i++) {
  13.     int[] row = matrix[i];
  14.       for (int j : row) {
  15.         result += j;
  16.       }
  17.     }
  18.                
  19.   return result;
  20. }