import org.junit.Before; import org.junit.Test; /** * Created by soi 2016/7/7. */ public class Ts { private String[][] array; @Before public void setUp() { //初始化數據 array = new String[][]{ new String[]{"00", "01", "02"}, new String[]{"10", "11", "12"} }; } @Test public void arrayToNewArray() { //新數組 String[][] newArray = new String[array[0].length][array.length]; for (int i = 0; i < array.length; i++) { for (int j = 0; j < array[i].length; j++) { newArray[j][i] = array[i][j]; } } } }