java獲取字節(jié)長度 如何獲取byte數(shù)組指定長度?
如何獲取byte數(shù)組指定長度?本文使用系統(tǒng)提供的靜態(tài)方法arraycopy()復制數(shù)組。Public static native void array copy(object SRC,int srcp
如何獲取byte數(shù)組指定長度?
本文使用系統(tǒng)提供的靜態(tài)方法arraycopy()復制數(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)
return BS
}
我不知道問這個問題的意義。我可以自己做。string類有一個getbyte方法。最好指定編碼getbyte(標準字符集.UTF-8)