矩阵组合

public class Main {
    public static void main(String[] args){
        String[][] xx={{"A1","A2","A3","A4"},{"B1","B2","B3"},{"C1","C2","C3"}};
        int total=1;
        //所有组合的计数
        for(String[] x:xx){
            total*=x.length;
        }
        String[][] xx2=new String[total][xx.length];
        /*
         A1B1C1
         A2B1C1
         A3B1C1
         A4B1C1
         A1B2C1
         A2B2C1
         A3B2C1
         A4B2C1
         A1B3C1
         A2B3C1
         A3B3C1
         A4B3C1
         A1B1C2
         A2B1C2
         A3B1C2
         A4B1C2
         A1B2C2
         A2B2C2
         A3B2C2
         A4B2C2
         A1B3C2
         A2B3C2
         A3B3C2
         A4B3C2
         A1B1C3
         A2B1C3
         A3B1C3
         A4B1C3
         A1B2C3
         A2B2C3
         A3B2C3
         A4B2C3
         A1B3C3
         A2B3C3
         A3B3C3
         A4B3C3
         */
        int m=1;
        for(int j=0;j

你可能感兴趣的:(JAVA,矩阵组合,数组组合,SKU组合)