[ת]javaÖÐbyteת»»intʱΪºÎÓë0xff½øÐÐÓëÔËËã
ÔÚÆÊÎö¸ÃÎÊÌâÇ°Çë¿´ÈçÏ´úÂë
public static String bytes2HexString(byte[] b) {
String ret = "";
for (int i = 0; i < b.length; i++) {
String hex = Integer.toHexString(b[ i ] & 0xFF);
if (hex.length() == 1) {
hex = '0' + hex;
}
ret += hex.toUpperCase();
}
return ret;
}
ÉÏÃæÊǽ«byte[]ת»¯Ê®Áù½øÖƵÄ×Ö·û´®,×¢ÒâÕâÀïb[ i ] & 0xFF½«Ò»¸öbyteºÍ 0xFF½øÐÐÁËÓëÔËËã,È»ºóʹÓÃInteger.toHexStringÈ¡µÃÁËÊ®Áù½øÖÆ×Ö·û´®,¿ÉÒÔ¿´³ö
b[ i ] & 0xFFÔËËãºóµÃ³öµÄÈÔÈ»ÊǸöint,ÄÇôΪºÎÒªºÍ 0xFF½øÐÐÓëÔËËãÄØ?Ö±½Ó Integer.toHexString(b[ i ]);,½«byteǿתΪint²»ÐÐÂð?´ð°¸ÊDz»ÐеÄ.
ÆäÔÒòÔÚÓÚ:
1.byteµÄ´óСΪ8bits¶øintµÄ´óСΪ32bits
2.javaµÄ¶þ½øÖƲÉÓõÄÊDz¹ÂëÐÎʽ
ÔÚÕâÀïÏÈÎÂϰϼÆËã»ú»ù´¡ÀíÂÛ
byteÊÇÒ»¸ö×Ö½Ú±£´æµÄ£¬ÓÐ8¸ö룬¼´8¸ö0¡¢1¡£
8λµÄµÚÒ»¸öλÊÇ·ûºÅ룬
Ò²¾ÍÊÇ˵0000 0001´ú±íµÄÊÇÊý×Ö1
1000 0000´ú±íµÄ¾ÍÊÇ-1
ËùÒÔÕýÊý×î´óλ0111 1111£¬Ò²¾ÍÊÇÊý×Ö127
¸ºÊý×î´óΪ1111 1111£¬Ò²¾ÍÊÇÊý×Ö-128
ÉÏÃæ˵µÄÊǶþ½øÖÆÔÂ룬µ«ÊÇÔÚjavaÖвÉÓõÄÊDz¹ÂëµÄÐÎʽ£¬ÏÂÃæ½éÉÜÏÂʲôÊDz¹Âë
1¡¢·´Â룺
Ò»¸öÊýÈç¹ûÊÇÕý£¬ÔòËüµÄ·´ÂëÓëÔÂëÏàͬ£»
Ò»¸öÊýÈç¹ûÊǸº£¬Ôò·ûºÅλΪ1£¬ÆäÓà¸÷λÊǶÔÔÂëÈ¡·´£»
2¡¢²¹Â룺ÀûÓÃÒç³ö£¬ÎÒÃÇ¿ÉÒÔ½«¼õ·¨±ä³É¼Ó·¨
¶ÔÓÚÊ®½øÖÆÊý£¬´Ó9µÃµ½5¿ÉÓüõ·¨£º
9£4£½5 ÒòΪ4+6£½10£¬ÎÒÃÇ¿ÉÒÔ½«6×÷Ϊ4µÄ²¹Êý
¸ÄдΪ¼Ó·¨£º
9+6£½15£¨È¥µô¸ßλ1£¬Ò²¾ÍÊǼõ10£©µÃµ½5.
¶ÔÓÚÊ®Áù½øÖÆÊý£¬´Ócµ½5¿ÉÓüõ·¨£º
c£7£½5 ÒòΪ7+9£½16 ½«9×÷Ϊ7µÄ²¹Êý
¸ÄдΪ¼Ó·¨£º
c+9£½15£¨È¥µô¸ßλ1£¬Ò²¾ÍÊǼõ16£©µÃµ½5.
ÔÚ¼ÆËã»úÖУ¬Èç¹ûÎÒÃÇÓÃ1¸ö×Ö½Ú±íʾһ¸öÊý£¬Ò»¸ö×Ö½ÚÓÐ8룬³¬¹ý8λ¾Í½ø1£¬ÔÚÄÚ´æÖÐÇé¿öΪ£¨100000000£©£¬½øλ1±»¶ªÆú¡£
¢ÅÒ»¸öÊýΪÕý£¬ÔòËüµÄÔÂë¡¢·´Âë¡¢²¹ÂëÏàͬ
Ïà¹ØÎĵµ£º
×î½ü³õ²½½Ó´¥ÁËÏÂJava¼ÓÃܺÍÊý×ÖÇ©ÃûµÄÏà¹ØÄÚÈÝ£¬ÎÒѧϰµÄ¹ý³Ì´ó¸Å·ÖÎå²½£º
1£©ÏûÏ¢ÕªÒª
2£©Ë½Ô¿¼ÓÃÜ
3£©¹«Ô¿¼ÓÃÜ
4£©Êý×ÖÇ©Ãû
5£©Êý×ÖÖ¤Êé
ÏÂÃæµÄ´úÂëÊǵÚËIJ¿·Ö£ºÊý×ÖÇ©Ãû
Ï£ÍûÄÜΪ¸Õ¸Õ½Ó´¥Õâ¸öµÄÅóÓÑÃÇÊ¡µãÊ package security;
import java.security.Signature;
import java.security.KeyPairGenerator ......
import java.util.concurrent.Semaphore;
/**
* ³éÏóÈÎÎñ£¬¾ßÌåµÄÖ´ÐÐÈÎÎñ£¬¹éʵÏÖÀฺÔð
*
* @author Administrator
*
*/
public abstract class Task {
public abstract void run();
private Semaphore s;
private boolean hasExisted = false;
public void P(final Semaphore s) throws Interrupt ......
ÈçºÎÍ£Ö¹javaµÄÏß³ÌÒ»Ö±ÊÇÒ»¸öÀ§ÄÕÎÒÃÇ¿ª·¢¶àÏ̳߳ÌÐòµÄÒ»¸öÎÊÌâ¡£Õâ¸öÎÊÌâ×îÖÕÔÚJava5µÄjava.util.concurrentÖеõ½Á˻شð£ºÊ¹ÓÃinterrupt()£¬ÈÃÏß³ÌÔÚrun·½·¨ÖÐÍ£Ö¹¡£ ¼ò½é ÔÚJavaµÄ¶àÏ̱߳à³ÌÖУ¬java.lang.ThreadÀàÐÍ°üº¬ÁËһЩÁеķ½·¨start(), stop(), stop(Throwable) and suspend(), destroy() and resume()¡£Í¨¹ ......
Java·¢Õ¹µ½ÏÖÔÚ£¬°´Ó¦ÓÃÀ´·ÖÖ÷Òª·ÖΪÈý´ó¿é£ºJ2SE,J2MEºÍJ2EE¡£ÕâÈý¿éÏ໥²¹³ä£¬Ó¦Ó÷¶Î§²»Í¬¡£
J2SE¾ÍÊÇJava2µÄ±ê×¼°æ£¬Ö÷ÒªÓÃÓÚ×ÀÃæÓ¦ÓÃÈí¼þµÄ±à³Ì£»
J2MEÖ÷ÒªÓ¦ÓÃÓÚǶÈëÊÇϵͳ¿ª·¢£¬ÈçÊÖ»úºÍPDAµÄ±à³Ì£»
J2EEÊÇJava2µÄÆóÒµ°æ£¬Ö÷ÒªÓÃÓÚ·Ö²¼Ê½µÄÍøÂç³ÌÐòµÄ¿ª·¢£¬Èçµç×ÓÉÌÎñÍøÕ¾ºÍERPϵͳ¡£
ÏÈѧϰj2se
Ҫѧϰj2ee¾ÍÒ ......
input stream Out stream
DataInputStream DataIOutStream
BufferedInputStream BufferedOutStream
LineNumberInputStream PrintStream
PushbackInputStream
ÒÔ×Ö½ÚΪµ¼
ÏòµÄ stream
----------(ÎÞ ......