0

I have method to convert 2d array of 3 (row and col) in to 2d method of 3+ 2 which is 2d array of 5(row and col). and the method give parameter of 2d array and find the total matrix. Here I have class and this class }

so and this my main class:

public static void main(String[] args) {
    Operation operation  = new Operation();

    int w[][] = {{1,2,3},{4,5,6},{7,8,9}};

    operation.convert(w);

Now the result it will come like the picture:

enter image description here

So I need to replace the zero with w array which is in main method.

1
  • the function part of the question is now missing. Commented Nov 6, 2017 at 14:39

1 Answer 1

1

I think all you need is:

newArray[i][j] = a[i-1][j-1]; // or perhaps a[j-1][i-1] if you want the transpose

You need to adjust the indices because newArray has an extra row and column at index 0.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.