• verification Code


    import java.util.Random;
    
    
    /**
     * verrification Code
     * @author TJX
     * @version 20121025
     */
    public class Code {
      static Random  rd=new Random();
      public static void main(String[] args){
          numCode();
          charCode();
          chineseCode();
          mixCode();
      }
      public static void numCode(){
          System.out.println("获取的五位数字验证码:");
          for(int i=0;i<5;i++){
              int n=rd.nextInt(10);
              System.out.print(n+" ");
          }
          System.out.println();
      }
      public static void charCode(){
          System.out.println("\n获取的五位字符验证码:");
          for(int i=0;i<5;i++){
              int n=65+rd.nextInt(58);
              System.out.print((char)n+" ");
          }
          System.out.println();
      }
      public static void chineseCode(){
          System.out.println("\n获取五位汉字验证码:");
          for(int i=0;i<5;i++){
              int n=20000+rd.nextInt(10000);
              System.out.print((char)n+" ");
          }
          System.out.println();
      }
      public static void mixCode(){
          System.out.println("\n获取五位混合验证码:");
          for(int i=0;i<5;i++){
              int n=rd.nextInt(123);
              if(n<65){
                  System.out.print(n%10+" ");
              }
              else{
                  System.out.print((char)n+" ");
              }
          }
      }
    }
  • 相关阅读:
    Struts2第一个入门案例
    Jquery form表单提交
    innerText和innerHTML
    FusionCharts Free 甘特图
    NVelocity模板引擎
    脚踏实地学C#5-扩展方法
    脚踏实地学C#4-静态类
    MySql服务无法启动
    头像截取
    脚踏实地学C#3-装箱和拆箱
  • 原文地址:https://www.cnblogs.com/ilxx1988/p/2738837.html
Copyright © 2020-2023  润新知