类 Bytes
java.lang.Object
net.apexes.commons.lang.Bytes
- 作者:
- HeDYn
-
方法概要
修饰符和类型方法说明static intbytesToInt(byte[] bytes) byte数组构成int类型值 与intToBytes(int)方法互逆,即 value == byteToInt(intToByte(value)) 恒为truestatic longbytesToLong(byte[] bytes) byte数组构成long类型值。static shortbytesToShort(byte[] bytes) byte数组构成short类型值static byte[]将表示十六进制值的字符串转换为byte数组 与toHex(byte[])方法互逆static StringhexFormat(byte[] bytes) 获取指定字节数组的HEX表示形式(每个字节用空格分隔)static byte[]intToBytes(int value) int型值转换成byte数组 与bytesToInt(byte[])方法互逆,即 value == byteToInt(intToByte(value)) 恒为truestatic byte[]longToBytes(long value) long型值转换成byte数组。static byte[]shortToBytes(short value) short型转byte数组static StringtoHex(byte value) static StringtoHex(byte[] bytes) 以十六进制字符串形式显示byte数组 与fromHex(String)方法互逆static StringtoHex(int value) static StringtoHex(long value) static StringtoHex(short value)
-
方法详细资料
-
bytesToInt
public static int bytesToInt(byte[] bytes) byte数组构成int类型值 与intToBytes(int)方法互逆,即 value == byteToInt(intToByte(value)) 恒为true- 参数:
bytes- 需要转换成int型值的byte数组- 返回:
- 返回指定字节数组构成的int值
-
intToBytes
public static byte[] intToBytes(int value) int型值转换成byte数组 与bytesToInt(byte[])方法互逆,即 value == byteToInt(intToByte(value)) 恒为true- 参数:
value- 值- 返回:
- 返回转换后的byte数组
-
bytesToLong
public static long bytesToLong(byte[] bytes) byte数组构成long类型值。 与longToBytes(long)方法互逆,即 value == bytesToLong(longToBytes(value)) 恒为true- 参数:
bytes- 需要转换成long型值的byte数组- 返回:
- 返回指定字节数组构成的long值
-
longToBytes
public static byte[] longToBytes(long value) long型值转换成byte数组。 与bytesToLong(byte[])方法互逆,即 value == bytesToLong(bytesToLong(value)) 恒为true- 参数:
value-- 返回:
-
bytesToShort
public static short bytesToShort(byte[] bytes) byte数组构成short类型值- 参数:
bytes-- 返回:
- 返回指定字节数组构成的short值
-
shortToBytes
public static byte[] shortToBytes(short value) short型转byte数组- 参数:
value-- 返回:
- 返回转换后的byte数组
-
fromHex
将表示十六进制值的字符串转换为byte数组 与toHex(byte[])方法互逆- 参数:
hex- 需要转换的十六进形式字符串- 返回:
- 转换后的byte数组
-
toHex
以十六进制字符串形式显示byte数组 与fromHex(String)方法互逆- 参数:
bytes- 字符数组- 返回:
- 返回字节数组的十六进制形式
-
toHex
-
toHex
-
toHex
-
toHex
-
hexFormat
获取指定字节数组的HEX表示形式(每个字节用空格分隔)- 参数:
bytes- 字节数组- 返回:
- 返回指定字节数组的HEX表示形式(每个字节用空格分隔)
-