java生成6位数所有组合

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
for(int i=0;i<=9;i++){
              String str="";
              str=str+i;
              String strj="";
              for(int j=0;j<=9;j++){
                  strj=str+j;
                  String strk="";
                  for(int k=0;k<=9;k++){
                      String strh="";
                      strk=strj+k;
                      for(int h=0;h<=9;h++){
                          strh=strk+h;
                          String strm="";
                          for(int m=0;m<=9;m++){
                              strm=strh+m;
                              String strn="";
                              for(int n=0;n<=9;n++){
                                  strn=strm+n;
                                   
                                      System.out.println(strn);
                                   
                              }
                          }
                      }
                  }
              }
          }

  

1
只提供思路,代码还可优化

posted on   Snowman-Nunu  阅读(599)  评论(0编辑  收藏  举报

努力加载评论中...

导航

点击右上角即可分享
微信分享提示