Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ----- JAVA CODE -----
- package jsx;
- import java.util.Random;
- import java.util.Scanner;
- import java.awt.Toolkit;
- import java.awt.datatransfer.StringSelection;
- public class Main {
- static String[] voc = { "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", "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", "0", "1", "2", "3", "4", "5", "6", "7",
- "8", "9", "!", "?", ":", ";", "@", "#", "$", "&", "%", "~", "—", "-", "_" };
- static Random random = new Random();
- static Scanner sc;
- public static void main(String[] args) {
- sc = new Scanner(System.in); // connect to console
- System.out.println("\nType password length next line.");
- String read = sc.nextLine(); // wait for input
- int get = 16; // default
- try {
- get = Integer.valueOf(read);
- } catch (Exception e) {
- e.printStackTrace();
- }
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < get; i++) {
- int k = random.nextInt(voc.length);
- sb.append(voc[k]);
- }
- String out = sb.toString();
- System.out.println("\n- This code has been copied to ur clipboard -\n" + out);
- Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(out), null); // copy to clipboard
- }
- }
- # ----- BATCH CODE -----
- java -jar PwdGen.jar
- pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement