This is my encapsulated version of a passwordgenerator in java. You create a new class in your project (i recommend you to use the name Passgenerate to avoid errors). The later you can call the function by typing:

Code: 
Passgenerate.Generate(properties)

Code: 
package YoupackageName; // change YoupackageName to you package in the project...

import java.util.ArrayList;
import java.util.Random;

public class Passgenerate {

    public static String Generate(int lenght, boolean Upperlower, boolean alphanumeric) {
        String[] lowercase = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};
        String[] Uppercase = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};
        String[] Numbers = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
        String txtOutput="";

        ArrayList<String> objlist = new ArrayList<String>();
        Random rnd = new Random();

        int i;

        for (i = 0; i < lowercase.length; i++) {
            objlist.add(lowercase[i]);
        }
        if (Upperlower == true) {
            for (i = 0; i < Uppercase.length; i++) {
                objlist.add(Uppercase[i]);
            }
        }
        if (alphanumeric == true) {
            for (i = 0; i < Numbers.length; i++) {
                objlist.add(Numbers[i]);
            }
        }
        for (i = 0; i < lenght; i++) {
            txtOutput = txtOutput + objlist.get(rnd.nextInt(objlist.size()));
        }
        return txtOutput;
    }
}
If you encounter some projects when using this class please post it so i can edit it
Dom Reviewed by Dom on . [TUT] Java passgenerator encapsulated This is my encapsulated version of a passwordgenerator in java. You create a new class in your project (i recommend you to use the name Passgenerate to avoid errors). The later you can call the function by typing: Passgenerate.Generate(properties) package YoupackageName; // change YoupackageName to you package in the project... import java.util.ArrayList; import java.util.Random; Rating: 5