By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy, 2020 Stack Exchange, Inc. user contributions under cc by-sa. If the matrix is symmetric in size, we can transpose the matrix … You can select the whole java code by clicking the select option and can use it. transpose[1][0]=2, 2nd iteration for(i=1;i