Here you can find the source of transpose(int[][] input)
public static int[][] transpose(int[][] input)
//package com.java2s; public class Main { public static int[][] transpose(int[][] input) { int[][] output = new int[input[0].length][input.length]; for (int i = 0; i < input.length; i++) { for (int j = 0; j < input[0].length; j++) { output[j][i] = input[i][j]; }//from www. java 2s . c o m } return output; } }