我正在尝试从随机字母中生成 5 个字母的单词。一切正常,但是当我单击按钮生成单词时,生成这些单词大约需要 2 分钟,而在这 2 分钟内,我的按钮仍然处于点击状态(蓝色),这看起来不太好。我想放处理环,但这也行不通。下面是我的方法的一些编码
String finalWrd = searchWrd.toUpperCase();
String twoLetterString = "";
int wordLen = searchWrd.length();//searchWrd is a random letter entered by user
String[] array = finalWrd.split("");
for(int i =1; i<=wordLen; i++)
for(int j=1; j<=wordLen; j++)
for(int K=1; K<=wordLen; K++)
for(int l=1; l<=wordLen; l++){
for(int m=1; m<=wordLen; m++){
twoLetterString += array[i] + array[j]+ array[K]+ array[l] + array[m] +",";
}
}
String[] array2Letters = twoLetterString.split(",");
int a =array2Letters.length, b = dictLinesArray.length;
for(int i =0;i<a; i++)
{
for(int l=0;l<b;l++)
{
if(array2Letters[i].equals(dictLinesArray[l]))
{
dictString2Lettes += dictLinesArray[l] +"," ;
}
}
}
text = dictString2Lettes;
请帮助我,我的大学项目需要它。提前致谢