- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
import java.util.InputMismatchException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
try {
System.out.println("How many characters will be in the password? (1-256):");
short length = scanner.nextShort();
if (length > 256) {
System.out.println("Password can't be longer than 256 characters!");
} else if (length < 1) {
System.out.println("Password can't be less than 1 character long!");
} else {
System.out.println("How many passwords will be generated? (1-32)");
byte amount = scanner.nextByte();
if (amount > 32) {
System.out.println("You can't generate more than 32 passwords!");
} else if (amount < 1) {
System.out.println("You can't generate less than 1 password!");
} else {
for (byte i = 0; i < amount; i++) {
System.out.println("\n" + PasswordGenerator.generate(length));
}
}
}
} catch (InputMismatchException e) {
System.out.println("Input error!");
}
}
}
Комментарии (0) RSS
Добавить комментарий