Answers for "get java matrix size"

1

java get size of matrix

//Get rows size matrix
matrix.length;
//Get columns size of matrix
matrix[0].length;
Posted by: Guest on May-23-2021
4

java length of matrix

public static void main(String[] args) {

    int[][] foo = new int[][] {
        new int[] { 1, 2, 3 },
        new int[] { 1, 2, 3, 4},
    };

    System.out.println(foo.length); //2
    System.out.println(foo[0].length); //3
    System.out.println(foo[1].length); //4
}
Posted by: Guest on April-22-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language