亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? randomstrg.java

?? java阿里巴巴代碼
?? JAVA
字號:

package com.ahbay.mysite;

import java.util.*;
import java.security.SecureRandom;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;

public class RandomStrg {

    private static Integer length = new Integer(8);
    public static void setLength(int count){ length =new Integer(count);}

    private static String randomstr;
    private static boolean allchars = false;
    
    private static HashMap hmap;
    private static ArrayList lower = null;
    private static ArrayList upper = null;
    private static char[] single = null;
    private static int singlecount = 0;
    private static boolean singles = false;
    private static String algorithm = null;
    private static String provider = null;
    private static boolean secure = false;
    private static Random random = null;
    private static SecureRandom secrandom = null;

    private static float getFloat() {
	if (random == null)
	    return secrandom.nextFloat();
	else
	    return random.nextFloat();
    }

    /**
     * generate the Random object that will be used for this random number 
     * generator
     *
     */
    public static void generateRandomObject() throws Exception {

	// check to see if the object is a SecureRandom object
	if (secure) {
	    try {
		// get an instance of a SecureRandom object
		if (provider != null)
		    // search for algorithm in package provider
		    random = SecureRandom.getInstance(algorithm, provider);
		else
		    random = SecureRandom.getInstance(algorithm);
	    } catch (NoSuchAlgorithmException ne) {
		throw new Exception(ne.getMessage());
	    } catch (NoSuchProviderException pe) {
		throw new Exception(pe.getMessage());
	    }
	} else
	    random = new Random();
    }
 
    /**
     * generate the random string
     *
     */
    private static void generaterandom() {

	if (allchars)
	    for (int i = 0; i < length.intValue(); i++)
		randomstr = randomstr + new Character((char)((int) 34 + 
				     ((int)(getFloat() * 93)))).toString();
	else if (singles) {
	    // check if there are single chars to be included

	    if (upper.size() == 3) {
		// check for the number of ranges max 3 uppercase lowercase digits

		// build the random string
		for (int i = 0; i < length.intValue(); i++) {
		    // you have four groups to choose a random number from, to make
		    // the choice a little more random select a number out of 100

		    // get a random number even or odd
		    if (((int) (getFloat() * 100)) % 2 == 0) {

			// the number was even get another number even or odd
			if (((int) (getFloat() * 100)) % 2 == 0)
			    // choose a random char from the single char group
			    randomstr = randomstr + randomSingle().toString();
			else
			    // get a random char from the first range
			    randomstr = randomstr + randomChar((Character)lower.get(2),
						(Character)upper.get(2)).toString();
		    } else {
			// the number was odd

			if (((int) (getFloat() * 100)) % 2 == 0)
			    // choose a random char from the second range
			    randomstr = randomstr + randomChar((Character)lower.get(1),
					       (Character)upper.get(1)).toString();
			else
			    // choose a random char from the third range
			    randomstr = randomstr + randomChar((Character)lower.get(0),  
					       (Character)upper.get(0)).toString();
		    }
		}
	    } else if (upper.size() == 2) {
		// single chars are to be included choose a random char from
		// two different ranges

		// build the random char from single chars and two ranges
		for (int i = 0; i < length.intValue(); i++) {
		    // select the single chars or a range to get each random char
		    // from

		    if (((int)(getFloat() * 100)) % 2 == 0) {

			// get random char from the single chars
			randomstr = randomstr + randomSingle().toString();
		    } else if (((int) (getFloat() * 100)) % 2 == 0) {

			// get the random char from the first range
			randomstr = randomstr + randomChar((Character)lower.get(1),
					       (Character)upper.get(1)).toString();
		    } else {

			// get the random char from the second range
			randomstr = randomstr + randomChar((Character)lower.get(0),
					       (Character)upper.get(0)).toString();
		    }
		}
	    } else if (upper.size() == 1) {

		// build the random string from single chars and one range
		for (int i = 0; i < length.intValue(); i++) {
		    if (((int) getFloat() * 100) % 2 == 0)
			// get a random single char
			randomstr = randomstr + randomSingle().toString();
		    else
			// get a random char from the range
			randomstr = randomstr + randomChar((Character)lower.get(0),
					       (Character)upper.get(0)).toString();
		}
	    } else {
		// build the rand string from single chars
		for (int i = 0; i < length.intValue(); i++)
		    randomstr = randomstr + randomSingle().toString();
	    }
	} else {

	    // no single chars are to be included in the random string
	    if (upper.size() == 3) {

		// build random strng from three ranges
		for (int i = 0; i < length.intValue(); i++) {

		    if (((int) (getFloat() * 100)) % 2 == 0) {

			// get random char from first range
			randomstr = randomstr + randomChar((Character)lower.get(2),
					       (Character)upper.get(2)).toString();
		    } else if (((int) (getFloat() * 100)) % 2 == 0) {

			// get random char form second range
			randomstr = randomstr + randomChar((Character)lower.get(1),
					       (Character)upper.get(1)).toString();
		    } else {

			// get random char from third range
			randomstr = randomstr + randomChar((Character)lower.get(0),
					       (Character)upper.get(0)).toString();
		    }
		}
	    } else if (upper.size() == 2) {

		// build random string from two ranges
		for (int i = 0; i < length.intValue(); i++) {
		    if (((int) (getFloat() * 100)) % 2 == 0)
			// get random char from first range
			randomstr = randomstr + randomChar((Character)lower.get(1),
					       (Character)upper.get(1)).toString();
		    else
			// get random char from second range
			randomstr = randomstr + randomChar((Character)lower.get(0),
					     (Character)upper.get(0)).toString();
		}
	    } else

		// build random string
		for (int i = 0; i < length.intValue(); i++)
		    // get random char from only range
		    randomstr = randomstr + randomChar((Character)lower.get(0), 
					       (Character)upper.get(0)).toString();
	}
    }

    /**
     * generate a random char from the single char list
     *
     * @returns - a randomly selscted character from the single char list
     *
     */
    private static Character randomSingle() {

	return (new Character(single[(int)((getFloat() * singlecount) - 1)]));
    }

    /**
     * generate a random character
     *
     * @param lower  lower bound from which to get a random char
     * @param upper  upper bound from which to get a random char
     *
     * @returns - a randomly generated character
     *
     */
    private static Character randomChar(Character lower, Character upper) {
	int tempval;
	char low = lower.charValue();
	char up = upper.charValue();

	// get a random number in the range lowlow - lowup
	tempval = (int)((int)low + (getFloat() * ((int)(up - low))));

	// return the random char
	return (new Character((char) tempval));
    }

    /**
     * get the randomly created string for use with the 
     * &lt;jsp:getProperty name=<i>"id"</i> property="randomstr"/&gt;
     *
     * @return - randomly created string
     *
     */
    public static String getRandom() {

	randomstr = new String();

	generaterandom(); // generate the first random string

	if (hmap != null) {

	    while (hmap.containsKey(randomstr)) {
		// random string has already been created generate a different one
		generaterandom();
	    }

	    hmap.put(randomstr, null);  // add the new random string
	}

	return randomstr;
    }

    /**
     * set the ranges from which to choose the characters for the random string
     *
     * @param low  set of lower ranges
     * @param up  set of upper ranges
     *
     */
    public static void setRanges(ArrayList low, ArrayList up) {
	lower = low;
	upper = up;
    }


    /**
     * set the hashmap that is used to check the uniqueness of random strings
     *
     * @param map  hashmap whose keys are used to insure uniqueness of random strgs
     *
     */
    public static void setHmap(HashMap map) {
	hmap = map;
    }

    /**
     * set the length of the random string
     *
     * @param value  length of the random string
     *
     */
    public static void setLength(String value) {
    	length = new Integer(value);
	    
    }

    /**
     * set the algorithm name
     *
     * @param value  name of the algorithm to use for a SecureRandom object
     *
     */
    public static void setAlgorithm(String value) {
	algorithm = value;
	secure = true;  // a SecureRandom object is to be used
    }

    /**
     * set the provider name
     *
     * @param value  name of the package to check for the algorithm
     *
     */
    public static void setProvider(String value) {
	provider = value;
    }

    /**
     * set the allchars flag
     *
     * @param value  boolean value of the allchars flag
     *
     */
    public static void setAllchars(boolean value) {
	allchars = value;
    }

    /**
     * set the array of single chars to choose from for this random string and the
     * number of chars in the array
     *
     * @param chars  the array of single chars
     * @param value  the number of single chars
     *
     */
    public static void setSingle(char[] chars, int value) {
	single = chars;  // set the array of chars
	singlecount = value;  // set the number of chars in array single
	singles = true;  // set flag that single chars are in use
    }
    
    public static void setCharset(String value) 
    {
	   // values tells the method whether or not to check for single chars
	   boolean more = true;

	   // create the arraylists to hold the upper and lower bounds for the char
	  // ranges
	  lower = new ArrayList(3);
	  upper = new ArrayList(3);

	  // user has chosen to use all possible characters in the random string
	  if (value.compareTo("all") == 0) {
	    allchars = true;  // set allchars flag
	    // all chars are to be used so there are no single chars to sort 
	    // through
	    more = false;
	  }else if ((value.charAt(1) == '-') && (value.charAt(0) != '\\')) {
	    // run through the ranges at most 3 
	    while (more && (value.charAt(1) == '-')){

		    // check to make sure that the dash is not the single char
	   	    if (value.charAt(0) == '\\')
       		    break;
      		else {
	    	    // add upper and lower ranges to there list
		        lower.add(new Character(value.charAt(0)));
		        upper.add(new Character(value.charAt(2)));
		    }

		    // check to see if there is more to the charset
		    if (value.length() <= 3)
      		    more = false;
		    else
      		    // create a new string so that the next range if there is one
		       // starts it
		       value = value.substring(3);
	     }
	}

	// if more = false there are no single chars in the charset
	if (more) {

	    single = new char[30];  // create single

	    // create a set of tokens from the string of single chars
	    StringTokenizer tokens = new StringTokenizer(value);

	    while (tokens.hasMoreTokens()) {
		// get the next token from the string
		String token = tokens.nextToken();

		if (token.length() > 1)
		    // char is a - add it to the list
		    single[singlecount++] = '-';

		// add the current char to the list
		single[singlecount++] = token.charAt(0);
	    }
	}
    if ((lower == null) && (single == null))
	    setCharset("a-zA-Z0-9");	
  }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品久久久久久妇女6080 | 91麻豆国产香蕉久久精品| 亚洲国产你懂的| 亚洲色图欧美在线| 亚洲综合免费观看高清完整版| 中文字幕不卡在线| **欧美大码日韩| 一区二区三区四区中文字幕| 精品福利一区二区三区| 欧美大肚乱孕交hd孕妇| 欧美日韩国产高清一区二区三区 | 久久一夜天堂av一区二区三区| 欧美一级夜夜爽| 亚洲国产精品精华液2区45| 国产精品久久久久久久岛一牛影视| 国产精品少妇自拍| 亚洲国产欧美在线| 国产呦精品一区二区三区网站| 成人手机电影网| 国产精品免费免费| 国产精品高潮久久久久无| 国产精品不卡一区二区三区| 6080yy午夜一二三区久久| 精品久久久影院| 亚洲人123区| 国产一区二区91| 91精品久久久久久蜜臀| 国产精品第一页第二页第三页| 亚洲成在人线免费| 91在线看国产| 亚洲精品一区二区三区精华液| 亚洲一区二区三区影院| 成人美女视频在线观看| 日韩一区二区免费在线电影| 亚洲精品你懂的| 色综合久久综合| 欧美国产亚洲另类动漫| 无码av免费一区二区三区试看| 奇米一区二区三区av| 欧美午夜精品一区| 亚洲欧美一区二区三区极速播放| 丰满放荡岳乱妇91ww| 欧美国产欧美综合| 99久久综合狠狠综合久久| 国产拍揄自揄精品视频麻豆| 国产成人免费在线观看不卡| 久久九九全国免费| 成人福利视频网站| 亚洲欧洲精品一区二区精品久久久| 国产1区2区3区精品美女| 久久久久国色av免费看影院| 国产成人欧美日韩在线电影| 国产欧美精品一区aⅴ影院| 国产一区美女在线| 国产精品激情偷乱一区二区∴| 成人av资源网站| 亚洲影院免费观看| 欧美一级欧美三级在线观看 | 91官网在线观看| 天涯成人国产亚洲精品一区av| 欧美一区二区三区小说| 国产一区二区精品在线观看| 一区在线播放视频| 在线中文字幕一区| 国产一二精品视频| 日韩毛片在线免费观看| 欧美日韩国产另类不卡| 日韩中文字幕91| 综合色天天鬼久久鬼色| 欧美va亚洲va| 欧美美女直播网站| 不卡的av在线播放| 国精产品一区一区三区mba视频| 亚洲欧美一区二区不卡| 久久蜜桃香蕉精品一区二区三区| 3751色影院一区二区三区| 亚洲va国产天堂va久久en| 久久影视一区二区| 欧美老女人在线| 91官网在线免费观看| 成人av高清在线| 国产成人午夜精品5599| 九九久久精品视频| 麻豆视频观看网址久久| 日韩精品免费视频人成| 精品影院一区二区久久久| 色天天综合色天天久久| 99精品欧美一区二区蜜桃免费 | 亚洲一区在线电影| 欧美日韩在线电影| 国产一区二区三区观看| 久久精品久久精品| 激情深爱一区二区| 国产一区福利在线| 国产成人av电影在线播放| 国产一区二区在线视频| 久久精品国产第一区二区三区| 一区二区三区四区五区视频在线观看| 久久久99久久| 国产精品二区一区二区aⅴ污介绍| 日本一区二区视频在线观看| 国产精品美女www爽爽爽| 一区二区三区视频在线观看| 亚洲午夜在线电影| 国产综合色视频| 欧美视频中文字幕| 91精品国产高清一区二区三区蜜臀| 丁香激情综合五月| gogogo免费视频观看亚洲一| 日本精品一区二区三区高清| 在线精品视频免费播放| 99久久综合精品| 欧美日韩国产成人在线91| 日韩午夜在线观看视频| 久久精品亚洲一区二区三区浴池| 久久精品日韩一区二区三区| 国产精品电影一区二区三区| 亚洲一级二级在线| 国产成人亚洲精品青草天美| 91网站黄www| 日韩欧美在线123| 国产精品久久久久精k8| 日韩黄色免费电影| 91丨九色丨蝌蚪富婆spa| 色综合视频一区二区三区高清| 欧美在线|欧美| 国产午夜精品久久| 久久精品av麻豆的观看方式| caoporen国产精品视频| 91精品国模一区二区三区| 国产精品人妖ts系列视频 | 欧美日本乱大交xxxxx| 在线综合+亚洲+欧美中文字幕| 国产情人综合久久777777| 日韩av不卡在线观看| 色菇凉天天综合网| 亚洲欧美色综合| www.亚洲精品| 亚洲欧美色图小说| 精品一区二区在线播放| 日韩欧美一二区| 蜜桃视频一区二区三区| 欧美挠脚心视频网站| 亚洲精品国产一区二区精华液 | 精品一区二区在线免费观看| 色综合久久精品| 石原莉奈在线亚洲三区| 欧美日韩不卡一区二区| 人禽交欧美网站| 欧美成人精品3d动漫h| 国产一区二区三区美女| 欧美国产乱子伦| 欧美午夜精品久久久久久孕妇| 亚洲国产一区二区a毛片| 777亚洲妇女| 国产99久久久国产精品潘金网站| 日本一区二区免费在线观看视频| 久久se精品一区精品二区| 欧美伊人精品成人久久综合97| 亚洲第一av色| 一道本成人在线| 爽爽淫人综合网网站| 亚洲人成网站精品片在线观看| 91麻豆产精品久久久久久 | 欧美电视剧在线看免费| 国产乱一区二区| 一区二区三区欧美日| 精品日韩在线观看| 国产suv精品一区二区三区| 亚洲高清久久久| 久久久精品黄色| 678五月天丁香亚洲综合网| 懂色av中文一区二区三区| 日日夜夜一区二区| 一区二区三区**美女毛片| 久久亚洲影视婷婷| 91精品国产91久久久久久一区二区 | 亚瑟在线精品视频| 国产精品色哟哟| 久久久一区二区| 欧美va亚洲va香蕉在线| 欧美一区三区二区| 成人av小说网| 99亚偷拍自图区亚洲| 日韩av电影天堂| 午夜精品成人在线| 亚洲成人av福利| 一区二区欧美精品| 亚洲国产欧美一区二区三区丁香婷| 国产精品国产馆在线真实露脸| 国产欧美一区二区精品仙草咪| 欧美日韩在线播放一区| 欧美在线色视频| 国内成人自拍视频| 成人黄色一级视频| 一本大道久久a久久综合 | 日本道在线观看一区二区| 在线亚洲一区二区| 欧美三级中文字| 欧美一二三四区在线|