隨筆-3  評(píng)論-0  文章-0  trackbacks-0

          package com.test.paixu;

          public class MyPaixu {
           
           public void paixu(char[] a,String tempStr){
            
            for(int i=0;i<a.length;i++){
             String temp = tempStr;
             if(1==a.length){
              temp+=a[0];
              System.out.println(temp);
              break;
             }
             char[] tempChar = new char[a.length-1];
             int t=0;
             temp+=a[i];
             for(int j=0;j<i;j++){
              tempChar[t]=a[j];
              t++;
             }
             for(int j=i+1;j<a.length;j++){
              tempChar[t]=a[j];
              t++;
             }
             paixu(tempChar,temp);
             
            }
           }
           public MyPaixu(){
            String str = "abcd";
            char[] ch = str.toCharArray();
            paixu(ch,"");
           }
           public static void main(String[] args){
            new MyPaixu();
           }
          }

           

          posted on 2010-04-27 12:04 fzllcc 閱讀(139) 評(píng)論(0)  編輯  收藏

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 安仁县| 威海市| 通河县| 桦甸市| 万宁市| 两当县| 武隆县| 客服| 白城市| 青铜峡市| 农安县| 桐梓县| 河曲县| 惠州市| 增城市| 合水县| 旺苍县| 武山县| 襄汾县| 珠海市| 武穴市| 织金县| 乐亭县| 馆陶县| 临泽县| 赤水市| 峡江县| 晋江市| 永福县| 宣汉县| 资中县| 鄢陵县| 望奎县| 新晃| 迭部县| 右玉县| 鹤山市| 天长市| 白朗县| 武邑县| 东至县|