第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

sort內(nèi)部按數(shù)字,大寫字母,小寫字母的優(yōu)先級(jí)排序,有圖有真相

public void testSort2(){

List<String>sb=new ArrayList<String>();

Random random=new Random();

//生成十條不重復(fù)的字符串(由數(shù)字和字母組成)

for(int i=0;i<10;i++){

StringBuffer str=new StringBuffer();

do{

//字符串長(zhǎng)度為10以內(nèi)的整數(shù),nextInt()范圍為[0,10),字符串長(zhǎng)度不想設(shè)置為空就加1

int size=1+random.nextInt(10);

//隨機(jī)生成字符串

for(int tempsize=0;tempsize<size;tempsize++){

int c;

do{

//隨機(jī)生成0到122的數(shù)字,0到9表示數(shù)字字符,65到90表示'A'到'Z'

//97到122表示'a'到'z'

c=(int)(Math.random()*123);

}

//當(dāng)生成的字符為'0'到'9'或'a'到'z'或'A'到'Z'時(shí)跳出

while(!((c>=0&&c<=9)||(c>='a'&&c<='z')||(c>='A'&&c<='Z')));

if(c>=0&&c<=9){

String s=Integer.toString(c);

str.append(s);

}

else{

char cr=(char)c;

String s=String.valueOf(cr);

str.append(s);

}

}https://img1.sycdn.imooc.com//5bdbf2720001d18502540461.jpg

}while(sb.contains(str.toString()));

//如果list沒有該字符串就加入

sb.add(str.toString());

}

System.out.println("排序前的字符串list為:");

for (String string : sb) {

System.out.println(string);

}

System.out.println("排序后的字符串list為:");

Collections.sort(sb);

for (String string : sb) {

System.out.println(string);

}

}


正在回答

1 回答

排序應(yīng)該是按照ASCII碼表上的順序進(jìn)行排列的,可以在百度上搜一下ASCII碼表,優(yōu)先級(jí)就出來了

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

sort內(nèi)部按數(shù)字,大寫字母,小寫字母的優(yōu)先級(jí)排序,有圖有真相

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)