public class NumberUtil extends Object
| 构造器和说明 |
|---|
NumberUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
ascii2string(String content)
ASCII码字符串转数字字符串
|
static int |
binary2decimal(String number)
二进制转十进制
|
static String |
byte2ascii(byte b)
ascii码
|
static String |
byte2bcd(byte bit) |
static BigInteger |
byte2big(byte[] bytes)
换字节流(字节数组)型数据转大数字
|
static String |
byte2binary(byte b)
将byte转成二进制
|
static int |
byte2decimal(byte res) |
static String |
byte2hex(byte b) |
static String |
byte2hex(byte[] bytes) |
static String |
byte2hex(byte[] bytes,
int len) |
static String |
byte2hex(byte[] bytes,
int len,
String split) |
static String |
byte2hex(byte[] bytes,
String split) |
static String[] |
byte2hexs(byte[] bytes) |
static int |
byte2int(byte[] bytes)
四个字节的字节数据转换成一个整形数据
|
static String |
byte2string(byte[] bytes) |
static String |
byte2string(byte[] bytes,
int fr,
int to) |
static String |
byte2string(byte[] bytes,
int fr,
int to,
String charset)
从byte数组中截取fr到to转换成String 按charset编码格式
|
static String |
byte2string(byte[] bytes,
String charset) |
static String |
bytes2bcd(byte[] bytes) |
static byte[] |
decimal2bcd(long num) |
static String |
decimal2binary(int number)
二进制转十进制
|
static String |
decimal2hex(int number) |
static String[] |
decimal2hex(int[] numbers) |
static String |
format(Number src,
String pattern)
数字格式化
|
static String |
format(String src,
String pattern)
数据格式化
|
static String[] |
hex2array(String hex)
16进制string拆分
0102 > ["01","02"] |
static byte |
hex2byte(String hex) |
static byte[] |
hex2bytes(String hex) |
static int |
hex2decimal(String hex)
16进制转10进制
|
static int |
hex2decimal(String[] hex,
int fr,
int to)
截取hex中fr到to部分转成10进制
|
static String |
hex2string(String hex) |
static String |
hex2string(String hex,
String charset)
16进制转String
e4b8ade696876162633132335f23 > 中文abc123_# |
byte[] |
int2bytes(int i)
整形转换成网络传输的字节流(字节数组)型数据
|
static byte[] |
int32bytes(BigInteger n)
大数字转换字节流(字节数组)型数据
|
static boolean |
isInt(double src) |
static boolean |
isInt(float src) |
static byte[] |
long2bytes(long l)
长整形转换成网络传输的字节流(字节数组)型数据
|
static BigDecimal |
max(BigDecimal... nums)
选取最大数
|
static double |
max(double... nums)
选取最大数
|
static float |
max(float... nums)
选取最大数
|
static int |
max(int... nums)
选取最大数
|
static long |
max(long... nums)
选取最大数
|
static short |
max(short... nums)
选取最大数
|
static BigDecimal |
min(BigDecimal... nums)
选取最小数
|
static double |
min(double... nums)
选取最小数
|
static float |
min(float... nums)
选取最小数
|
static int |
min(int... nums)
选取最小数
|
static long |
min(long... nums)
选取最小数
|
static short |
min(short... nums)
选取最小数
|
static double |
random(double fr,
double to) |
static List<Double> |
random(double fr,
double to,
int qty) |
static float |
random(float fr,
float to) |
static List<Float> |
random(float fr,
float to,
int qty) |
static int |
random(int fr,
int to) |
static List<Integer> |
random(int fr,
int to,
int qty) |
static long |
random(long fr,
long to) |
static List<Long> |
random(long fr,
long to,
int qty) |
static String |
string2ascii(String str)
数字字符串转ASCII码字符串
|
static byte[] |
string2bytes(String src) |
static byte[] |
string2bytes(String src,
String charset) |
static String |
string2hex(String origin) |
static String |
string2hex(String origin,
String charset)
String转16进制
中文abc123_# >e4b8ade696876162633132335f23 |
static String |
upper(long num)
中文大写(简体)
|
public static String format(String src, String pattern)
src - srcpattern - patternpublic static String format(Number src, String pattern)
src - srcpattern - patternpublic static String upper(long num)
num - numpublic static BigDecimal max(BigDecimal... nums)
nums - numspublic static BigDecimal min(BigDecimal... nums)
nums - numspublic static double max(double... nums)
nums - numspublic static double min(double... nums)
nums - numspublic static int max(int... nums)
nums - numspublic static int min(int... nums)
nums - numspublic static long max(long... nums)
nums - numspublic static long min(long... nums)
nums - numspublic static float max(float... nums)
nums - numspublic static float min(float... nums)
nums - numspublic static short max(short... nums)
nums - numspublic static short min(short... nums)
nums - numspublic static int random(int fr,
int to)
public static double random(double fr,
double to)
public static long random(long fr,
long to)
public static float random(float fr,
float to)
public static boolean isInt(double src)
public static boolean isInt(float src)
public static int binary2decimal(String number)
number - numberpublic static String decimal2binary(int number)
number - numberpublic byte[] int2bytes(int i)
i - 一个整型数据public static int byte2int(byte[] bytes)
bytes - 4个字节的字节数组public static byte[] long2bytes(long l)
l - 一个长整型数据public static byte[] int32bytes(BigInteger n)
n - public static BigInteger byte2big(byte[] bytes)
bytes - bytespublic static int hex2decimal(String hex)
hex - hexpublic static int hex2decimal(String[] hex, int fr, int to)
hex - hex数组fr - 开始位置to - 结束位置public static String byte2hex(byte[] bytes, int len)
public static String byte2hex(byte[] bytes)
public static String[] byte2hexs(byte[] bytes)
public static String byte2hex(byte b)
public static String decimal2hex(int number)
public static String[] decimal2hex(int[] numbers)
public static String byte2string(byte[] bytes, int fr, int to, String charset)
bytes - bytesfr - frto - tocharset - 编码public static String byte2string(byte[] bytes, int fr, int to)
public static String byte2string(byte[] bytes)
public static byte[] hex2bytes(String hex)
public static byte hex2byte(String hex)
public static byte[] decimal2bcd(long num)
public static String byte2binary(byte b)
b - bytepublic static int byte2decimal(byte res)
public static String byte2ascii(byte b)
b - bytepublic static String byte2bcd(byte bit)
public static String bytes2bcd(byte[] bytes)
public static String string2hex(String origin, String charset)
origin - 原文public static String hex2string(String hex, String charset)
hex - hexpublic static String[] hex2array(String hex)
hex - hexpublic static byte[] string2bytes(String src)
public static String string2ascii(String str)
str - 字符串Copyright © 2022. All rights reserved.