| | |
| | | package com.anyun.im_lib.util; |
| | | |
| | | import android.text.TextUtils; |
| | | import android.util.Log; |
| | | |
| | | import java.nio.ByteBuffer; |
| | | import java.nio.CharBuffer; |
| | |
| | | */ |
| | | public class ByteUtil { |
| | | |
| | | |
| | | private static final String TAG = "ByteUtil"; |
| | | /** |
| | | * @功能: BCD码转为10进制串(阿拉伯数据) |
| | | * @参数: BCD码 |
| | |
| | | byte b = (byte) a; |
| | | bbt[p] = b; |
| | | } |
| | | Log.i(TAG, "str2Bcd: "+byte2HexStr(bbt)); |
| | | return bbt; |
| | | } |
| | | |
| | |
| | | System.out.println(byte2HexStr(shortGetBytes((short) b))); |
| | | } |
| | | |
| | | public static byte[] subArray(byte[] srcBytes, int begin, int length) { |
| | | byte[] bytes = new byte[length]; |
| | | System.arraycopy(srcBytes,begin,bytes,0,length); |
| | | Log.i(TAG, "subArray: "+byte2HexStr(bytes)); |
| | | return bytes; |
| | | } |
| | | } |