Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

findSum() method finds the sum of all the elements in the 2Darray. findOdds() me

ID: 3607906 • Letter: F

Question

  • findSum() method finds the sum of all the elements in the 2Darray.
  • findOdds() method finds the odd elements in each row andreturns the odd elements of the 2D array in a new 2D array. Ex: 2Darray: {{1,2,3},{3,4,6},{3,8,5}} à method returns{{1,3},{3},{3,5}}
  • findEvens() method finds the even elements in each row andreturns the even elements of the 2D array in a new 2D array. Ex: 2Darray: {{1,2,3},{3,4,6},{3,8,5}} à method returns{{},{4,6},{8}}
  • findPowerOf3() method finds the elements that are power of 3 ineach row and returns these elements of the 2D array in a new 2Darray. Ex: 2D array: {{1,2,3},{3,4,6},{3,8,5}} à methodreturns {{3},{3,6},{3}}

Explanation / Answer

class Test{int [][]data;public void init(){int i,j;int [][]temp = {{1,2,3},{4,5,6},{7,8,9}};data = new int[3][3];for(i=0;i