Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

how to convert 2d to 1d array in java

public static int mode(int[][] arr)
{
  int[] oneDArray = new int[arr.length * arr.length];
  for(int i = 0; i < arr.length; i ++)
  {
    for(int s = 0; s < arr.length; s ++)
    {
      oneDArray[(i * arr.length) + s] = arr[i][s];
    }
  }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #convert #array #java
ADD COMMENT
Topic
Name
8+9 =