最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

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

為什么有時(shí)候會(huì)輸出空值

package?com.imooc.collection;import?java.util.ArrayList;import?java.util.Collections;import?java.util.List;import?java.util.Random;public?class?TestCollectionsSortString?{		/**	*?生成隨機(jī)字符串	*?@param?length	*?@return	*/	public?String?getRandomString(int?length)?{		String?str?="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";		Random?random=new?Random();????????StringBuffer?sb=new?StringBuffer();????????for(int?i=0;i<length;i++){????????????//產(chǎn)生62以?xún)?nèi)的隨機(jī)數(shù),因?yàn)榻M成隨機(jī)字符串的字符有62個(gè)????????????int?number=random.nextInt(62);????????????//將str的第number個(gè)字符加到sb的末尾????????????sb.append(str.charAt(number));????????}????????return?sb.toString();	}		/**	*?讓隨機(jī)字符串的長(zhǎng)度為10以?xún)?nèi)隨機(jī)整數(shù),并進(jìn)行排序輸出	*/	public?void?testSort()?{		List<String>?stringList?=?new?ArrayList<String>();		Random?random?=?new?Random();		int?k;		String?str;		for(int?i=0;i<10;i++)?{			k?=?random.nextInt(10);			do?{				str=getRandomString(k);			}while(stringList.contains(str));			stringList.add(str);			System.out.println("成功添加:"+str);		}		System.out.println("------------排序前-----------");		for?(String?string?:?stringList)?{			System.out.println("元素:"+string);		}		Collections.sort(stringList);		System.out.println("------------排序后-----------");		for?(String?string?:?stringList)?{			System.out.println("元素:"+string);		}	}		public?static?void?main(String[]?args)?{		TestCollectionsSortString?tcss?=?new?TestCollectionsSortString();		tcss.testSort();	}}


正在回答

1 回答

太亂了,小哥哥

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

舉報(bào)

0/150
提交
取消

為什么有時(shí)候會(huì)輸出空值

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

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

幫助反饋 APP下載

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

公眾號(hào)

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