From c5e5d0720d1f0805963ce218a9bd7e5da5a6e7a5 Mon Sep 17 00:00:00 2001 From: zhubaomin <zhubaomin> Date: 星期三, 18 九月 2024 15:27:51 +0800 Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV --- pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java | 103 --------------------------------------------------- 1 files changed, 0 insertions(+), 103 deletions(-) diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java index 6819327..2f0c7d6 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java @@ -1059,109 +1059,6 @@ } - - private static final char[] HEX_CHAR = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; -// /** -// * 灏哹yte[]杞崲涓�16杩涘埗瀛楃涓� -// * -// * @param bytes 寰呰浆鎹yte[] -// * @return 杩斿洖 杞崲鍚庣殑瀛楃涓� -// */ -// public static String bytesToHex(byte[] bytes) { -// //涓�涓猙yte涓�8浣嶏紝鍙敤涓や釜鍗佸叚杩涘埗浣嶆爣璇� -// char[] buf = new char[bytes.length * 2]; -// int a = 0; -// int index = 0; -// for (byte b : bytes) { // 浣跨敤闄や笌鍙栦綑杩涜杞崲 -// if (b < 0) { -// a = 256 + b; -// } else { -// a = b; -// } -// -// buf[index++] = HEX_CHAR[a / 16]; -// buf[index++] = HEX_CHAR[a % 16]; -// } -// return new String(buf); -// } -// /** -// * 灏哹yte[]杞崲涓�16杩涘埗瀛楃涓� -// * -// * @param bytes 寰呰浆鎹yte[] -// * @return 杩斿洖 杞崲鍚庣殑瀛楃涓� -// */ -// public static String bytesToHex_BE(byte[] bytes, int startIndex, int endIndex) { -// byte[] bs = new byte[endIndex - startIndex + 1] ; -// byte j = 0 ; -// for(int i = startIndex; i <= endIndex; i++){ -// bs[j++] = bytes[i] ; -// } -// //涓�涓猙yte涓�8浣嶏紝鍙敤涓や釜鍗佸叚杩涘埗浣嶆爣璇� -// char[] buf = new char[bs.length * 2]; -// int a = 0; -// int index = 0; -// for (byte b : bs) { // 浣跨敤闄や笌鍙栦綑杩涜杞崲 -// if (b < 0) { -// a = 256 + b; -// } else { -// a = b; -// } -// -// buf[index++] = HEX_CHAR[a / 16]; -// buf[index++] = HEX_CHAR[a % 16]; -// } -// return new String(buf); -// } -// -// /** -// * 灏哹yte[]杞崲涓�16杩涘埗瀛楃涓� -// * -// * @param bytes 寰呰浆鎹yte[] -// * @return 杩斿洖 杞崲鍚庣殑瀛楃涓� -// */ -// public static String bytesToHex_LE(byte[] bytes, int startIndex, int endIndex) { -// byte[] bs = new byte[endIndex - startIndex + 1] ; -// byte j = 0 ; -// for(int i = endIndex; i >= startIndex; i--){ -// bs[j++] = bytes[i] ; -// } -// //涓�涓猙yte涓�8浣嶏紝鍙敤涓や釜鍗佸叚杩涘埗浣嶆爣璇� -// char[] buf = new char[bs.length * 2]; -// int a = 0; -// int index = 0; -// for (byte b : bs) { // 浣跨敤闄や笌鍙栦綑杩涜杞崲 -// if (b < 0) { -// a = 256 + b; -// } else { -// a = b; -// } -// -// buf[index++] = HEX_CHAR[a / 16]; -// buf[index++] = HEX_CHAR[a % 16]; -// } -// return new String(buf); -// } -// -// /** -// * 灏�16杩涘埗瀛楃涓茶浆鎹负byte[] -// * -// * @param str 寰呰浆鎹㈠瓧绗︿覆 -// * @return 杩斿洖 杞崲鍚庣殑byte[] -// */ -// public static byte[] hexToBytes(String str) { -// if (str == null || "".equals(str.trim())) { -// return new byte[0]; -// } -// -// byte[] bytes = new byte[str.length() / 2]; -// for (int i = 0; i < str.length() / 2; i++) { -// String subStr = str.substring(i * 2, i * 2 + 2); -// bytes[i] = (byte) Integer.parseInt(subStr, 16); -// } -// -// return bytes; -// } - /** * Convert char to byte * @param c char -- Gitblit v1.8.0