Just to add my 2 cents because I was thinking of implementing a matrix transpose by myself.
Could we add an wrapper to the original java 2D array?
When you transpose a matrix, you don't transpose the actual array at all, instead simply flag it as transpose=true in the wrapper.
When you want to access value at (3,2) via the wrapper, the wrapper swaps the row and column indices and return the value at (2,3)
You can do the same to other operations until an actual transpose is "really" necessary.
By "really" I mean the actual transposed matrix has computation performance advantages than using the original matrix, which mainly depends on what operations you will perform on the matrix.