1.随机取6位数的数字,做为密码

      public String getpassword(){
  
              Random r = new Random();
              int x = r.nextInt(999999);
              String a = String.valueOf(x);
              return a;
      }

2.取8位数做为用户名,前两位为AD,后几位为从数据库中取出的ID,不足8位时中间补0

      public String getLoginName(String seqcode){
               //seqcode是传过来的流水号
               int id = Integer.parseInt(seqcode);
               String LoginName="AD"+(""+(id+1000000)).substring(1);
               return LoginName;
      }

3.从数据库中取出密码,用*把密码替换掉

      //oldPassword是从库中取出的密码,"."表示任意字符

         String newPassword = oldPassword.replaceAll(".","*");

相关文章:

  • 2022-12-23
  • 2021-12-16
  • 2021-08-19
  • 2022-12-23
  • 2021-12-13
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-15
  • 2022-12-23
  • 2021-11-11
  • 2022-01-10
  • 2022-01-03
相关资源
相似解决方案