Package com.project

Class PassGenerator

java.lang.Object
com.project.PassGenerator

public class PassGenerator extends Object
The PassGenerator class generates random passwords based on user-selected criteria:
  • Password length.
  • Inclusion of numbers, uppercase, lowercase, and special characters.

The program uses a Random instance to select random characters from the chosen character sets. It displays the generated password and allows the user to generate multiple passwords in a loop.

Version:
1.0.0
Author:
Anurag Zete
  • Field Details

    • isNumbersIncluded

      private static boolean isNumbersIncluded
      Flag indicating if numbers should be included.
    • isUppercaseLettersIncluded

      private static boolean isUppercaseLettersIncluded
      Flag indicating if uppercase letters should be included.
    • isLowercaseLettersIncluded

      private static boolean isLowercaseLettersIncluded
      Flag indicating if lowercase letters should be included.
    • isSpecialCharactersIncluded

      private static boolean isSpecialCharactersIncluded
      Flag indicating if special characters should be included.
    • numbers

      private static final String numbers
      Set of numeric characters (0-9).
      See Also:
    • lowercaseLetters

      private static final String lowercaseLetters
      Set of lowercase alphabetic characters (a-z).
      See Also:
    • uppercaseLetters

      private static final String uppercaseLetters
      Set of uppercase alphabetic characters (A-Z).
      See Also:
    • specialCharacters

      private static final String specialCharacters
      Set of special characters.
      See Also:
  • Constructor Details

    • PassGenerator

      public PassGenerator()
  • Method Details

    • main

      public static void main(String[] args)
      The main entry point for the password generator application.

      Displays a banner, prompts the user for password criteria, generates a password, and allows multiple password generations in a loop.

      Parameters:
      args - The command-line arguments (not used).
    • promptUser

      private static void promptUser(Scanner sc)
      Prompts the user to select character sets for password generation.

      Asks whether to include:

      • Numbers
      • Uppercase letters
      • Lowercase letters
      • Special characters
      Parameters:
      sc - The Scanner object used for user input.
    • buildCharSet

      private static void buildCharSet(StringBuilder charSet)
      Builds the final character set for password generation.

      Appends characters from the selected categories to the character set.

      Parameters:
      charSet - The StringBuilder to store the combined character set.
    • checkValidity

      private static boolean checkValidity(Scanner sc)
      Validates the user's input (Y/N) for character set inclusion.
      Parameters:
      sc - The Scanner object used for input.
      Returns:
      true if the user selects 'Y', otherwise false.