2d array algorithms java code example
Example 1: arrays sort 2d array java
Arrays.sort(myArr,(double[] a,double[] b)->{
//here multiple lines of code can be placed
return a[0]-b[0];
});
Example 2: 2d array java
//Length
int[][]arr= new int [filas][columnas];
arr.length=filas;
int[][] a = {
{1, 2, 3},
{4, 5, 6, 9},
{7},
};
// calculate the length of each row
System.out.println("Length of row 1: " + a[0].length);
System.out.println("Length of row 2: " + a[1].length);
System.out.println("Length of row 3: " + a[2].length);
}