ÍøÉÏÕÒÁ˸öjavaËæ»úÉú³ÉÃÜÂëµÄ¡£¡£¡£·¢ÉÏÀ´¼Ç¼һÏ¡£
import java.util.Random;
public class test {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(genRandomNum(10));
}
/**
* Éú³ÉËæ¼´ÃÜÂë
* @param pwd_len Éú³ÉµÄÃÜÂëµÄ×ܳ¤¶È
* @return ÃÜÂëµÄ×Ö·û´®
*/
public static String genRandomNum(int pwd_len){
//35ÊÇÒòΪÊý×éÊÇ´Ó0¿ªÊ¼µÄ£¬26¸ö×Öĸ+10¸öÊý×Ö
final int maxNum = 36;
int i; //Éú³ÉµÄËæ»úÊý
int count = 0; //Éú³ÉµÄÃÜÂëµÄ³¤¶È
char[] str = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k',
'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
StringBuffer pwd = new StringBuffer("");
Random r = new Random();
while(count < pwd_len){
//Éú³ÉËæ»úÊý£¬È¡¾ø¶ÔÖµ£¬·ÀÖ¹Éú³É¸ºÊý£¬
i = Math.abs(r.nextInt(maxNum)); //Éú³ÉµÄÊý×î´óΪ36-1
if (i >= 0 && i < str.length) {
pwd.append(str[i]);
count ++;
}
}
return pwd.toString();
}
}
Ïà¹ØÎĵµ£º
ÏÈÀ´Á˽âÒ»ÏÂÁ´±íģʽµÄÔÀí£º
Ê×ÏÈдһ¸öJavaBean£¬ÄÚÈÝÊÇÒªÌí¼ÓµÄÔªËغ͸ÃÔªËصĽڵ㡣
public class NodeBean implements Serializable
{
private Object data; //ÔªËر¾Éí
private NodeBean next; //ÏÂÒ»¸ö½Úµã
&n ......
³õ¶ÁÕâ±¾Ê飬¸Ð¾õȷʵ²»´í£¬×÷ÕߺÜÓÐʵÁ¦¡£µÚÈýÕÂÌáµ½Èí¼þµÄ¿Éά»¤ÐԺͿɸ´ÓÃÐÔ£¬×÷ÕßÊǽèÖújavaÓïÑԵĻúÖÆ£¬À´½²½âÁËÃæÏò¶ÔÏóÉè¼ÆģʽµÄÖØҪ֪ʶ¡£
Ò»¸öÈí¼þËæ×ÅÐÔÄÜÒªÇóµÄ±ä»¯¶ø±äµÃ“¸¯ÀÔµÄÔÒòÓÐ4¸ö£º¹ýÓÚ½©Ó²£¬¹ýÓÚ´àÈõ£¬¸´ÓÃÂʵͣ¬ð¤¶È¹ý¸ß¡£
½©Ó²£ºÈç¹ûÐèÒª¸øÒ»¸öϵͳÔö¼ÓÒ»¸ö¹¦Ä ......
1¡¢ ÀàÐÍ×°ÔØ¡¢Á´½ÓÓë³õʼ»¯
JavaÐéÄâ»úͨ¹ý×°ÔØ¡¢Á´½ÓºÍ³õʼ»¯Ò»¸öJavaÀàÐÍ£¬Ê¹¸ÃÀàÐÍ¿ÉÒÔ±»ÕýÔÚÔËÐеÄJava³ÌÐòËùʹÓá£ÆäÖУ¬×°ÔؾÍÊǰѶþ½øÖƵÄJavaÀàÐͶÁÈëJavaÐéÄâ»úÖУ¬¶øÁ¬½Ó¾ÍÊÇ°ÑÕâÖÖÒѾ¶ÁÈëÐéÄâ»úµÄ¶þ½øÖÆÐÎʽµÄÀàÐÍÊý¾ÝºÏ²¢µ½ÐéÄâ»úµÄÔËÐÐ״̬ÖÐÈ¥¡£Á¬½Ó½×¶Î·ÖÁËÈý¸ö²½Ö裺Ñé ......
1 ×Ö·û´®±È½ÏÊÇ·ñÏàµÈÓÃʲô·½·¨£¿
2 equals£¨£©ºÍhashCode£¨£©µÄÇø±ð£¿
3 forwardºÍsenRedirectÇø±ð£¿
4 servletÉúÃüÖÜÆÚ£¿
5 ¹ýÂËÆ÷µÄ×÷ÓÃ
6 JSP°üº¬¾²Ì¬ÎļþµÄÓï·¨
7 JSP×¢ÊÍ£¨ÖÁÉÙÁ½¸öÒÔÉÏ£©
8 tableÖÐborder£¬cellpadding,tdÖÐcolspan,rowspanµÄÒâÒå
9 jsÈýÖÖµ¯³ö´°¿Ú a ¾¯¸æ b È·ÈÏ c ÐÅÏ¢ ......
// ÕûÊýµ½×Ö½ÚÊý×éת»»
public static byte[] int2bytes(int n) {
byte[] ab = new byte[4];
ab[0] = (byte) (0xff & n);
ab[1] = (byte) ((0xff00 & n) >> 8);
ab[2] = (byte) ((0xff0000 & n) >> 16);
ab[3] = (byte) ((0xff000000 & n) >> 24);
return ab ......