public class BitUtils extends Object
| 构造器和说明 |
|---|
BitUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static byte[] |
getBytes(boolean data)
以字节数组的形式返回指定的布尔值
|
static byte[] |
getBytes(char data)
以字节数组的形式返回指定的 Unicode 字符值
|
static byte[] |
getBytes(double data)
以字节数组的形式返回指定的双精度浮点值
|
static byte[] |
getBytes(float data)
以字节数组的形式返回指定的单精度浮点值
|
static byte[] |
getBytes(int data)
以字节数组的形式返回指定的 32 位有符号整数值
|
static byte[] |
getBytes(long data)
以字节数组的形式返回指定的 64 位有符号整数值
|
static byte[] |
getBytes(short data)
以字节数组的形式返回指定的 16 位有符号整数值
|
static byte[] |
getBytes(String data)
将指定字符串中的所有字符编码为一个字节序列
|
static byte[] |
getBytes(String data,
String charsetName)
将指定字符串中的所有字符编码为一个字节序列
|
static boolean |
toBoolean(byte[] bytes)
返回由字节数组转换来的布尔值
|
static boolean |
toBoolean(byte[] bytes,
int startIndex)
返回由字节数组中的指定的一个字节转换来的布尔值
|
static char |
toChar(byte[] bytes)
返回由字节数组转换来的 Unicode 字符
|
static char |
toChar(byte[] bytes,
int startIndex)
返回由字节数组中的指定的两个字节转换来的 Unicode 字符
|
static double |
toDouble(byte[] bytes)
返回由字节数组转换来的双精度浮点数
|
static double |
toDouble(byte[] bytes,
int startIndex)
返回由字节数组中的指定的八个字节转换来的双精度浮点数
|
static float |
toFloat(byte[] bytes)
返回由字节数组转换来的单精度浮点数
|
static float |
toFloat(byte[] bytes,
int startIndex)
返回由字节数组中的指定的四个字节转换来的单精度浮点数
|
static String |
toHexString(byte[] bytes)
以字符串表示形式返回字节数组的内容
|
static int |
toInt(byte[] bytes)
返回由字节数组转换来的 32 位有符号整数
|
static int |
toInt(byte[] bytes,
int startIndex)
返回由字节数组中的指定的四个字节转换来的 32 位有符号整数
|
static long |
toLong(byte[] bytes)
返回由字节数组转换来的 64 位有符号整数
|
static long |
toLong(byte[] bytes,
int startIndex)
返回由字节数组中的指定的八个字节转换来的 64 位有符号整数
|
static short |
toShort(byte[] bytes)
返回由字节数组转换来的 16 位有符号整数
|
static short |
toShort(byte[] bytes,
int startIndex)
返回由字节数组中的指定的两个字节转换来的 16 位有符号整数
|
static String |
toString(byte[] bytes)
返回由字节数组转换来的字符串
|
static String |
toString(byte[] bytes,
String charsetName)
返回由字节数组转换来的字符串
|
public static byte[] getBytes(boolean data)
data - 一个布尔值public static byte[] getBytes(short data)
data - 要转换的数字public static byte[] getBytes(char data)
data - 要转换的字符public static byte[] getBytes(int data)
data - 要转换的数字public static byte[] getBytes(long data)
data - 要转换的数字public static byte[] getBytes(float data)
data - 要转换的数字public static byte[] getBytes(double data)
data - 要转换的数字public static byte[] getBytes(String data)
data - 包含要编码的字符的字符串public static byte[] getBytes(String data, String charsetName)
data - 包含要编码的字符的字符串charsetName - 字符集编码public static boolean toBoolean(byte[] bytes)
bytes - 字节数组public static boolean toBoolean(byte[] bytes,
int startIndex)
bytes - 字节数组startIndex - 起始下标public static short toShort(byte[] bytes)
bytes - 字节数组public static short toShort(byte[] bytes,
int startIndex)
bytes - 字节数组startIndex - 起始下标public static char toChar(byte[] bytes)
bytes - 字节数组public static char toChar(byte[] bytes,
int startIndex)
bytes - 字节数组startIndex - 起始下标public static int toInt(byte[] bytes)
bytes - 字节数组public static int toInt(byte[] bytes,
int startIndex)
bytes - 字节数组startIndex - 起始下标public static long toLong(byte[] bytes)
bytes - 字节数组public static long toLong(byte[] bytes,
int startIndex)
bytes - 字节数组startIndex - 起始下标public static float toFloat(byte[] bytes)
bytes - 字节数组public static float toFloat(byte[] bytes,
int startIndex)
bytes - 字节数组startIndex - 起始下标public static double toDouble(byte[] bytes)
bytes - 字节数组public static double toDouble(byte[] bytes,
int startIndex)
bytes - 字节数组startIndex - 起始下标public static String toString(byte[] bytes)
bytes - 字节数组public static String toString(byte[] bytes, String charsetName)
bytes - 字节数组charsetName - 字符集编码public static String toHexString(byte[] bytes)
bytes - 字节数组Copyright © 2020. All rights reserved.