JAVA
java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.util.Scanner;
public class Validator {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter you password: ");
String psw = scanner.nextLine();
byte res = checkPassword(psw);
if (res == 15) {
System.out.println(true);
} else {
System.out.println(false);
System.out.println("Code of mistake: " + res);
}
}
public static byte checkPassword(String password) {
int len = password.length();
byte res = 0;
if (len >= 6 && len <= 20) {
res |= 8;
}
for (int i = 0; i < len; i++) {
char c = password.charAt(i);
if (c >= 'A' && c <= 'Z') {
res |= 1;
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Uruchom