Here you can find the source of transpose(byte[][] d)
public static byte[][] transpose(byte[][] d)
//package com.java2s; //License from project: Open Source License public class Main { public static double[][] transpose(double[][] d) { double[][] ret = new double[d[0].length][d.length]; for (int i = 0; i < d[0].length; i++) { for (int j = 0; j < d.length; j++) { ret[i][j] = d[j][i];//from w w w .j av a2s. c om } } return ret; } public static int[][] transpose(int[][] d) { int[][] ret = new int[d[0].length][d.length]; for (int i = 0; i < d[0].length; i++) { for (int j = 0; j < d.length; j++) { ret[i][j] = d[j][i]; } } return ret; } public static float[][] transpose(float[][] d) { float[][] ret = new float[d[0].length][d.length]; for (int i = 0; i < d[0].length; i++) { for (int j = 0; j < d.length; j++) { ret[i][j] = d[j][i]; } } return ret; } public static byte[][] transpose(byte[][] d) { byte[][] ret = new byte[d[0].length][d.length]; for (int i = 0; i < d[0].length; i++) { for (int j = 0; j < d.length; j++) { ret[i][j] = d[j][i]; } } return ret; } public static String[][] transpose(String[][] d) { String[][] ret = new String[d[0].length][d.length]; for (int i = 0; i < d[0].length; i++) { for (int j = 0; j < d.length; j++) { ret[i][j] = d[j][i]; } } return ret; } public static Object[][] transpose(Object[][] d) { Object[][] ret = new Object[d[0].length][d.length]; for (int i = 0; i < d[0].length; i++) { for (int j = 0; j < d.length; j++) { ret[i][j] = d[j][i]; } } return ret; } }