public class MathUtil extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static byte[] |
merge(byte[]... arrays) |
static byte[] |
merge(byte[] a,
byte[] b)
两个byte数组对接
|
static byte[] |
sub(byte[] src,
int from,
int to)
获取一个byte数组的一部分
|
static byte[] |
toBit(byte value)
获取一个字节的8个bit
|
static byte[] |
toBit(byte[] value)
将一个byte数组转为bit数组
|
static byte |
toByte(byte[] bits)
8bit转1byte,不足8bit的,高位补0
|
static byte[] |
toByte(int value,
int size)
整型转指定长度的byte数组(大端、网络字节序)
|
static byte[] |
toByte(long value,
int size)
长整型转指定长度的byte数组(大端、网络字节序)
|
static byte[] |
toBytes(byte[] bits)
bit数组转byte数组,不足位数的,高位补0
|
static int |
toInt(byte[] b)
byte数组转整型(大端、网络字节序)
|
static long |
toLong(byte[] b)
byte数组转长整型(大端、网络字节序)
|
public static byte[] toBit(byte value)
value - 1字节数据public static byte[] toBit(byte[] value)
value - byte数据public static byte toByte(byte[] bits)
bits - bit数组public static byte[] toBytes(byte[] bits)
bits - bit数组public static byte[] toByte(int value,
int size)
value - 整型数字size - byte长度public static byte[] toByte(long value,
int size)
value - 整型数字size - byte长度public static int toInt(byte[] b)
b - byte数组public static long toLong(byte[] b)
b - byte数组public static byte[] merge(byte[] a,
byte[] b)
a - 前b - 后public static byte[] merge(byte[]... arrays)
public static byte[] sub(byte[] src,
int from,
int to)
src - 源数组from - 开始点,从0开始计算,包含to - 结束点,从0开始计算,包含Copyright © 2023. All Rights Reserved.