public class ByteUtil extends Object
| 构造器和说明 |
|---|
ByteUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static double |
bytesToDouble(byte[] bytes)
byte数组转Double
默认以小端序转换 |
static double |
bytesToDouble(byte[] bytes,
ByteOrder byteOrder)
byte数组转double
自定义端序 |
static int |
bytesToInt(byte[] bytes)
byte[]转int值
默认以小端序转换 |
static int |
bytesToInt(byte[] bytes,
ByteOrder byteOrder)
byte[]转int值
自定义端序 |
static long |
bytesToLong(byte[] bytes)
byte数组转long
默认以小端序转换 from: https://stackoverflow.com/questions/4485128/how-do-i-convert-long-to-byte-and-back-in-java |
static long |
bytesToLong(byte[] bytes,
ByteOrder byteOrder)
byte数组转long
自定义端序 from: https://stackoverflow.com/questions/4485128/how-do-i-convert-long-to-byte-and-back-in-java |
static short |
bytesToShort(byte[] bytes)
byte数组转short
默认以小端序转换 |
static short |
bytesToShort(byte[] bytes,
ByteOrder byteOrder)
byte数组转short
自定义端序 |
static int |
byteToUnsignedInt(byte byteValue)
byte转无符号int
|
static byte[] |
doubleToBytes(double doubleValue)
double转byte数组
默认以小端序转换 |
static byte[] |
doubleToBytes(double doubleValue,
ByteOrder byteOrder)
double转byte数组
自定义端序 from: https://stackoverflow.com/questions/4485128/how-do-i-convert-long-to-byte-and-back-in-java |
static byte |
intToByte(int intValue)
int转byte
|
static byte[] |
intToBytes(int intValue)
int转byte数组
默认以小端序转换 |
static byte[] |
intToBytes(int intValue,
ByteOrder byteOrder)
int转byte数组
自定义端序 |
static byte[] |
longToBytes(long longValue)
long转byte数组
默认以小端序转换 from: https://stackoverflow.com/questions/4485128/how-do-i-convert-long-to-byte-and-back-in-java |
static byte[] |
longToBytes(long longValue,
ByteOrder byteOrder)
long转byte数组
自定义端序 from: https://stackoverflow.com/questions/4485128/how-do-i-convert-long-to-byte-and-back-in-java |
static byte[] |
numberToBytes(Number number)
将
Number转换为 |
static byte[] |
numberToBytes(Number number,
ByteOrder byteOrder)
将
Number转换为 |
static byte[] |
shortToBytes(short shortValue)
short转byte数组
默认以小端序转换 |
static byte[] |
shortToBytes(short shortValue,
ByteOrder byteOrder)
short转byte数组
自定义端序 |
public static byte intToByte(int intValue)
intValue - int值public static int byteToUnsignedInt(byte byteValue)
byteValue - byte值public static short bytesToShort(byte[] bytes)
bytes - byte数组public static short bytesToShort(byte[] bytes,
ByteOrder byteOrder)
bytes - byte数组byteOrder - 端序public static byte[] shortToBytes(short shortValue)
shortValue - short值public static byte[] shortToBytes(short shortValue,
ByteOrder byteOrder)
shortValue - short值byteOrder - 端序public static int bytesToInt(byte[] bytes)
bytes - byte数组public static int bytesToInt(byte[] bytes,
ByteOrder byteOrder)
bytes - byte数组byteOrder - 端序public static byte[] intToBytes(int intValue)
intValue - int值public static byte[] intToBytes(int intValue,
ByteOrder byteOrder)
intValue - int值byteOrder - 端序public static byte[] longToBytes(long longValue)
longValue - long值public static byte[] longToBytes(long longValue,
ByteOrder byteOrder)
longValue - long值byteOrder - 端序public static long bytesToLong(byte[] bytes)
bytes - byte数组public static long bytesToLong(byte[] bytes,
ByteOrder byteOrder)
bytes - byte数组byteOrder - 端序public static byte[] doubleToBytes(double doubleValue)
doubleValue - double值public static byte[] doubleToBytes(double doubleValue,
ByteOrder byteOrder)
doubleValue - double值byteOrder - 端序public static double bytesToDouble(byte[] bytes)
bytes - byte数组public static double bytesToDouble(byte[] bytes,
ByteOrder byteOrder)
bytes - byte数组byteOrder - 端序public static byte[] numberToBytes(Number number)
Number转换为number - 数字Copyright © 2021. All rights reserved.