字節(jié)數(shù)組和字符數(shù)組 java中如何將字符串轉(zhuǎn)化成特定長度的字節(jié)數(shù)組?
java中如何將字符串轉(zhuǎn)化成特定長度的字節(jié)數(shù)組?本文使用系統(tǒng)提供的靜態(tài)方法arraycopy()復(fù)制數(shù)組。Public static native void array copy(object SRC
java中如何將字符串轉(zhuǎn)化成特定長度的字節(jié)數(shù)組?
本文使用系統(tǒng)提供的靜態(tài)方法arraycopy()復(fù)制數(shù)組。
Public static native void array copy(object SRC,int srcpos,object DeST,int destpos,int length)
SRC:source array
DeST:destination array
length:length to copy
示例:截斷byte array中指定長度的數(shù)組
[Java]查看純拷貝
Public static byte[]subbytes(byte[]SRC,int begin,int)count){
byte[]BS=新字節(jié)[計數(shù)]系統(tǒng).arraycopy(src,begin,bs,0,count)
返回bs
}