美文网首页
矩形方阵数据转换

矩形方阵数据转换

作者: 开心的小哈 | 来源:发表于2021-05-11 09:41 被阅读0次
    public static void main(String[] args) throws InterruptedException, IOException {
            int a[][]= {{11,12,13,14},{15,16,17,18},{19,20,21,22},{23,24,25,26}};
            int b[][]=new int[4][4];
            PhantomjsTest2 phantomjsTest2 = new PhantomjsTest2();
            phantomjsTest2.shouArray(a);
            phantomjsTest2.ordArray(a, b);
        System.out.println();
            phantomjsTest2.shouArray(b);
            
         }
         public void shouArray(int a[][]) {
             for(int i=0;i<a.length;i++) {
                    System.out.println();
                    for(int j=0;j<a[i].length;j++) {
                        System.out.print(a[i][j]+" ");
                    }
                }
         }
         
         public void ordArray(int a[][],int b[][]) {
             for(int i=0;i<a.length;i++) {
            for(int j=0;j<a[i].length;j++) {
                        b[j][i]=a[i][j];
                    }
                }
         }
    

    相关文章

      网友评论

          本文标题:矩形方阵数据转换

          本文链接:https://www.haomeiwen.com/subject/rudkiktx.html