国产chinesehdxxxx野外,国产av无码专区亚洲av琪琪,播放男人添女人下边视频,成人国产精品一区二区免费看,chinese丰满人妻videos

App下載
首頁javaarrayJava Collection - 如何使用隨機選擇的字符從不同的數(shù)組填充數(shù)組

Java Collection - 如何使用隨機選擇的字符從不同的數(shù)組填充數(shù)組

我們想知道如何使用隨機選擇的字符從不同的數(shù)組填充數(shù)組。
public class Main {

  public static void main(String[] args) {
    char[] anArray = { '!', '@', '#', '$', '%', '^', '&', '*', '+', '=', '~',
        '<', '>', '?' };
    int passwordLength = 20, symbolCount = 9;

    while (symbolCount > anArray.length) {
      symbolCount = (anArray.length - 1);
    }
    char[] patternArray = new char[passwordLength];

    int srcIndex = 0;
    for (int j = 0; j < passwordLength; j++) {
      patternArray[j] = anArray[srcIndex];
      srcIndex++;
      if (srcIndex > (anArray.length - 1))
        srcIndex = 0;
    }
    System.out.print(patternArray);
  }
}