Java Password Generate generateString(int length)

Here you can find the source of generateString(int length)

Description

generate String

License

Apache License

Declaration

public static String generateString(int length) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.Random;

public class Main {
    public static final String bigChar = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    public static String generateString(int length) {
        StringBuffer sb = new StringBuffer();
        Random random = new Random();
        for (int i = 0; i < length; i++) {
            sb.append(bigChar.charAt(random.nextInt(bigChar.length())));
        }// w  w w  .  ja v  a  2s  .com
        return sb.toString();
    }
}

Related

  1. generatePassword(int minLen, int maxLen, int noOfCAPSAlpha, int noOfDigits, int noOfSplChars)
  2. generateString(final String letters, int length)
  3. generateString(int length)
  4. generateString(int length)
  5. generateString(int length)
  6. GenerateString(int Length)
  7. generateString(int maxlength)
  8. generateString(String alphabet, int length)
  9. generateString(String charSet, int len)