title: Multiplication of 2D array matrices(Not matrix multiplication but normal multiplication to an element with the corresponding one)
body: <p>I have an assignment to write a method that would perform piecewise multiplications.
  My method header should be: </p>
  
  <pre><code>public static double [][] multiply(int [][] a, double [][]b)
  </code></pre>
  
  <p>Return null if the dimensions do not agree. In order to check for the first and second dimension use: a.length and a[0].length You can safely assume that the arrays are rectangular.</p>
  
  <p>The matrices are in this form</p>
  
  <pre><code>  a  b  c  
    d  e  f
    g  h  i
  </code></pre>
  
  <p>&amp;</p>
  
  <pre><code>  j  k  l
    m  n  o
    p  q  r
  </code></pre>
  
  <p>Here is what I came out with:</p>
  
  <pre><code>Random randomGenerator = new Random();
  a = new int [a.length][a[0].length];
  
  for (int i=0; i&lt;a.length; i++) {
    for(int j=0; j&lt;a[0].length; j++) {
      a[i][j]=(int)(randomGenerator.nextDouble()*255.0);
    }
  }
  
  for (int i=0; i&lt;a.length; i++) {
    for(int j=0; j&lt;a[0].length; j++) {
      System.out.print(a[i][j]+" ");
    }
    System.out.println();
  }
  
  b=new double[b.length][b[0].length];
  for (int i=0; i&lt;b.length; i++) {
    for(int j=0; j&lt;b[0].length; j++) {
      b[i][j]=randomGenerator.nextDouble()*255.0
        }
  
  }
  
        double[][] result  = new double[3][3];
        result = a[i][j]*b[i][j];
  
        if([a.length]!=[b.length]&amp;&amp;[a[0].length]!=[b[0].length]){
        return null;
        }
        else{
        return result;
        }
  </code></pre>
  
  <p>Is it possible that the user choses the dimension himself ?
  How can I do that?</p>
  
  <p>Does this code multiply each element of the matrix with the other element of the matrix?</p>
  
  <p>Are all the conditions satisfied?</p>