String(byte[] ascii, int hibyte)
Deprecated. This method does not properly convert bytes into characters. As of JDK 1.1, the preferred way to do this is via the String constructors that take a charset name or that use the platform's default charset. String(byte[] ascii, int hibyte, int offset, int count)
Deprecated. This method does not properly convert bytes into characters. As of JDK 1.1, the preferred way to do this is via the String constructors that take a charset name or that use the platform's default charset.
Deprecated. This method does not properly convert bytes into characters. As of JDK 1.1, the preferred way to do this is via the String constructors that take a charset name or that use the platform's default charset. String(byte[] ascii, int hibyte, int offset, int count)
Deprecated. This method does not properly convert bytes into characters. As of JDK 1.1, the preferred way to do this is via the String constructors that take a charset name or that use the platform's default charset.
String类的getBytes()方法就可以把String拆成byte.然后你再对BYTE进行加密行么?
这个函数在那个包下?
望告知!谢先
int ascChr ;
int i ;
String ss = "" ;
String rtStr = "地从" ;
int length = rtStr.length() ;
for ( i = 0 ; i < length ; i++ )
{
temChr = rtStr.charAt( i ) ;
ascChr = temChr + 0 ;
ss = ss + "&#x" + Integer.toHexString( ascChr ) + ";" ;//转回来String sArray[] = ss.split(";");
byte bArray[] = new byte[2 * sArray.length];
for (i = 0 ; i < sArray.length; i++) {
try {
int tmp = Integer.parseInt(sArray[i].substring(3), 16);
System.out.println(">>>>>int value is " + sArray[i].substring(3));
bArray[i*2 + 1] = (byte)(tmp & 0xff);
bArray[i*2 ] = (byte)((tmp >> 8) & 0xff);
} catch (NumberFormatException e) {
e.printStackTrace();
}
}
System.out.println("convert to orginal String is " + new String(bArray));
散分~!
那如何将byte转换为String类型?????????????????????解决后散分
String a=new String(b);
你便可以得到转换后的String,这个方法简单又方便。