Java ×Ö·û´®,byte[],16½øÖƵÄ×Ö·û´®»¥×ª
ÔÚµ÷ÊÔµÄʱºò£¬Èç¹ûÒªÏÔʾbyteµÄÖµÊÇ·ñÓëÔ¤ÆÚÒ»Ö£¬Ò»°ãת»»Îª16½øÖƵÄ×Ö·û´®£¬»òÕßʹÓÃbase64ת»»ºó£¬È»ºóÏÔʾ³öÀ´¡£
/**
* ×Ö·û´®×ª»»³ÉÊ®Áù½øÖÆ×Ö·û´®
*/
public static String str2HexStr(String str) {
char[] chars = "0123456789ABCDEF".toCharArray();
StringBuilder sb = new StringBuilder("");
byte[] bs = str.getBytes();
int bit;
for (int i = 0; i < bs.length; i++) {
bit = (bs[i] & 0x0f0) >> 4;
sb.append(chars[bit]);
bit = bs[i] & 0x0f;
sb.append(chars[bit]);
}
return sb.toString();
}
/**
*
* Ê®Áù½øÖÆ×ª»»×Ö·û´®
*/
public static String hexStr2Str(String hexStr) {
String str = "0123456789ABCDEF";
char[] hexs = hexStr.toCharArray();
byte[] bytes = new byte[hexStr.length() / 2];
int n;
for (int i = 0; i < bytes.length; i++) {
n = str.indexOf(hexs[2 * i]) * 16;
n += str.indexOf(hexs[2 * i + 1]);
bytes[i] = (byte) (n & 0xff);
}
return new String(bytes);
}
/**
* bytesת»»³ÉÊ®Áù½øÖÆ×Ö·û´®
*/
public static String byte2HexStr(byte[] b) {
String hs = "";
String stmp = "";
for (int n = 0; n < b.length; n++) {
stmp = (Integer.toHexString(b[n] & 0XFF));
if (stmp.length() == 1)
hs = hs + "0" + stmp;
else
hs = hs + stmp;
// if (n<b.length-1) hs=hs+":";
}
return hs.toUpperCase();
}
private static byte uniteBytes(String src0, String src1) {
byte b0 = Byte.decode("0x" + src0).byteValue();
b0 = (byte) (b0 << 4);
byte b1 = Byte.decode("0x" + src1).byteValue();
byte ret = (byte) (b0 | b1);
return ret;
}
/**
* bytesת»»³ÉÊ®Áù½øÖÆ×Ö·û´®
*/
public static byte[] hexStr2Bytes(String src) {
int m = 0, n = 0;
int l = src.length() / 2;
System.out.println(l);
byte[] ret = new byte[l];
for (int i = 0; i < l; i++) {
m = i * 2 + 1;
n = m + 1;
ret[i] = uniteBytes(src.substring(i * 2, m), src.substring(m, n));
}
return ret;
}
/**
*StringµÄ×Ö·û´®×ª»»³Éuni
Ïà¹ØÎĵµ£º
//ÊäÈëijÄêijÔÂijÌ죬Êä³öÕâÒ»ÌìÊÇÕâÒ»ÄêµÄµÚ¼¸Ìì
public class DaySum {
public static void main(String[] args)
{
date da=new date();
System.out.println(da.count(2008,12,31));
}
}
class date
{
int count(int year,int month,int day) ......
×î½ü£¬Éî¿ÌµÄÈÏʶµ½£¬ ѧϰ£¬²»½öÒª¶à¿´Ê飬»¹ÒªÊ±²»Ê±µÄ×ܽáһϣº
ÓÃJSP + Servlet + JavaBean¿ª·¢ÏîÄ¿£¬ ÔÒÔΪÊDZȽÏÔã¸âµÄÊ£¬ ÒòΪ£¬JSP Ò³ÃæÖÐ ×ܻᱻǶÈëºÜ¶à java´úÂ룬ÆäʵÎÒÒ»Ö±¾õµÃ£¬¼ÈÈ»ÓÐÁË strutsµÈ±íʾ²ã¿ò¼Ü£¬¾Í²»ÒªÓÃServlet À´×ö¿ØÖÆÆ÷ÁË£¬ ¿ÉÊÇ×î½ü£¬Ã÷°×ÁË£¬ ×Ð ......
ÔÚÍøÉÏ¿´µ½ºÜ¶àÈ˶¼ÔÚΪDelphiÊÇ·ñÖ§³ÖC++/JavaÖеľ²Ì¬±äÁ¿¼°¾²Ì¬·½·¨µÄ¹¦ÄܶøÀ§ÈÅ,ÆäʵÕâÔÚDelphiÖÐÊǺܼòµ¥µÄ.
¾²Ì¬·½·¨¾ÍÊÇʹÓÃClass Function. ¾²Ì¬±äÁ¿ÔòʹÓõ¥Ôª¾Ö²¿±äÁ¿À´ÊµÏÖ. ´úÂëÈçÏÂ:
//=========================================
// StaticVarTestU - ¶¨ÒåÁË¿ÉÒÔ¼ÆÊýµÄÀ࣬ͨ¹ýÀà·½·¨¼´¿É·ÃÎÊ´ËÀàµÄ¶ÔÏóÊý ......
Õâ±¾ÊéÏêϸ½²½âÁËģʽÀíÂÛµÄÓÉÀ´£¨ºÜ¶àÈË¿ÉÄܲ»ÖªµÀģʽÀíÂÛÓëÖйúµÀ¼Ò˼ÏëµÄÔ¨Ô´£©£¬ÃæÏò¶ÔÏóµÄÈí¼þÉè¼ÆÔÔò£¬Ò»Ö±½²µ½¶þÊ®¼¸¸öÉè¼ÆÄ£Ê½£¬ÒÔ¼°ÕâЩģʽÔÚJavaÓïÑÔÖеÄʵÏֵȵȡ£ÊéÖиø³öÁË´óÁ¿À´×Ô»ª¶û½ÖϵͳµÄÕæÊµÏîÄ¿µÄÀý×Ó£¬ÓÃÀ´½²½âÉè¼ÆÄ£Ê½ÔÚϵͳÉè¼ÆÖеÄÓ¦ÓᣠÕâ±¾Êé´¦ÓÚÀíÂÛºÍʵ¼ùÖ®¼ä£¬ÊÇÒ»±¾¶¨Î»¶ÀÌØ¡¢·ç¸ñ¶ÀÌØµ ......