This commit is contained in:
2024-02-20 16:08:28 +08:00
parent 055a55cda1
commit e6bfafa686
2 changed files with 5 additions and 4 deletions

View File

@@ -504,7 +504,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
if (hex.length() == 1) {
hex = '0' + hex;
}
return "0x" + hex.toUpperCase();
return Constants.HEX_PREFIX + hex.toUpperCase();
}
/**
@@ -548,9 +548,9 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
* @return byte
*/
public static byte uniteBytes(byte src0, byte src1) {
byte _b0 = Byte.decode("0x" + new String(new byte[]{src0}));
byte _b0 = Byte.decode(Constants.HEX_PREFIX + new String(new byte[]{src0}));
_b0 = (byte) (_b0 << 4);
byte _b1 = Byte.decode("0x" + new String(new byte[]{src1}));
byte _b1 = Byte.decode(Constants.HEX_PREFIX + new String(new byte[]{src1}));
byte ret = (byte) (_b0 ^ _b1);
return ret;
}

View File

@@ -1,5 +1,6 @@
package com.jsowell.common.util.id;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.exception.UtilException;
import java.security.MessageDigest;
@@ -133,7 +134,7 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
throw new IllegalArgumentException("Invalid UUID string: " + name);
}
for (int i = 0; i < 5; i++) {
components[i] = "0x" + components[i];
components[i] = Constants.HEX_PREFIX + components[i];
}
long mostSigBits = Long.decode(components[0]).longValue();