mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 19:45:09 +08:00
update
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
package com.jsowell.common.util;
|
||||
|
||||
import com.google.common.primitives.Bytes;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
@@ -563,6 +563,9 @@ public class BytesUtil {
|
||||
* @Description 16进制字符串转字节数组
|
||||
*/
|
||||
public static byte[] hexString2Bytes(String src) {
|
||||
if (src.startsWith(Constants.HEX_PREFIX)) {
|
||||
src = StringUtils.replace(src, Constants.HEX_PREFIX, "");
|
||||
}
|
||||
int l = src.length() / 2;
|
||||
byte[] ret = new byte[l];
|
||||
for (int i = 0; i < l; i++) {
|
||||
@@ -631,12 +634,12 @@ public class BytesUtil {
|
||||
* @param bigDecimal
|
||||
* @return
|
||||
*/
|
||||
public static byte[] bigDecimal2Bcd(BigDecimal bigDecimal) {
|
||||
int i = Float.floatToIntBits(bigDecimal.floatValue());
|
||||
String hexString = Integer.toHexString(i);
|
||||
return hexString2Bytes(hexString);
|
||||
|
||||
}
|
||||
// public static byte[] bigDecimal2Bcd(BigDecimal bigDecimal) {
|
||||
// int i = Float.floatToIntBits(bigDecimal.floatValue());
|
||||
// String hexString = Integer.toHexString(i);
|
||||
// return hexString2Bytes(hexString);
|
||||
//
|
||||
// }
|
||||
|
||||
/**
|
||||
* int 转 byte[]
|
||||
|
||||
Reference in New Issue
Block a user