-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Expand file tree
/
Copy pathPipeline_Test.java
More file actions
59 lines (42 loc) · 1.51 KB
/
Pipeline_Test.java
File metadata and controls
59 lines (42 loc) · 1.51 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package com.microsoft.demo;
import java.util.Random;
public class Pipeline_Test {
public String MyTestPipeline(String s){
String rev = "";
char [] w = s.toCharArray();
for(int i = s.length()-1; i>=0; i--){
rev = rev.concat(String.valueOf(w[i]));
}
return rev;
}
public char[] random_password(int len)
{
System.out.println("Generating password using random function : ");
System.out.print("Your new password is : ");
// A strong password has Cap_chars, Lower_chars,
// numeric value and symbols. So we are using all of
// them to generate our password
String Capital_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
String Small_chars = "abcdefghijklmnopqrstuvwxyz";
String numbers = "0123456789";
String symbols = "!@#$%^&*_=+-/.?<>)";
String values = Capital_chars + Small_chars +
numbers + symbols;
// Using random method
Random rndm_method = new Random();
char[] password = new char[len];
for (int i = 0; i < len; i++)
{
// Use of charAt() method : to get character value
// Use of nextInt() as it is scanning the value as int
password[i] =
values.charAt(rndm_method.nextInt(values.length()));
}
return password;
}
// public static void main(String[] args) {
//
// int length = 10;
// System.out.println(random_password(length));
// }
}