zoukankan      html  css  js  c++  java
  • java随机生成数字字母混合密码工具类

    说明:只做记录,方便以后使用,只是不想重复造轮子

    package uti.home;
    
    import java.io.BufferedReader;
    import java.io.BufferedWriter;
    import java.io.File;
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.IOException;
    
    public class tt {
    
        public static void main(String[] args) throws IOException {
            
              File f = new File("C:\Users\HUAWEI\Desktop\data.txt");
              BufferedWriter bw= new BufferedWriter(new FileWriter("C:\Users\HUAWEI\Desktop\temp.txt"));
              BufferedReader br = new BufferedReader(new FileReader(f));
              String line =null;
              while((line=br.readLine())!=null) { 
                  if(!line.contains("<-")) {
                      line = line.concat("	->密码"+getpass(8)).concat("
    ");
                  }else {
                      line = line.concat("
    ");
                  }
                  bw.write(line); 
             } 
              bw.flush();
              bw.close();
             
            
        }
        public static String getpass(int nums) {
            StringBuffer sb = new StringBuffer();
            for(int i=0;i<nums/2;i++) {
                int num = (int) (Math.random() * 10);
                int numchar = (int) (Math.random() * 26);
                
                sb.append(num).append((char)(numchar+65));
            }
            return sb.toString();
        }
    }
  • 相关阅读:
    influxdb服务器 relay
    browse-agent type and curl post
    使用 Ansible 管理 MySQL 复制
    ansible里的item和with_items
    Ansible 从MySQL数据库添加或删除用户
    ansibel---tag模块
    ll | wc -l的陷阱
    ansible 判断和循环
    Ansible详解(二)
    Ansible详解(一)
  • 原文地址:https://www.cnblogs.com/g177w/p/13804244.html
Copyright © 2011-2022 走看看