Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {

    public static char[] getCheckChar(int textlength) {
        char[] tempCheckNum = new char[textlength];
        for (int i = 0; i < textlength; i++) {
            char charCode;
            if (Math.random() > 0.5d) {
                charCode = (char) (Math.random() * 26 + 'A');
            } else {
                charCode = (char) (Math.random() * 10 + '0');
            }
            tempCheckNum[i] = charCode;
        }
        return tempCheckNum;
    }
}