From b6d93e08adb11e7f4584173d9d44dbc7c7508e9f Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期一, 27 十一月 2023 17:50:23 +0800
Subject: [PATCH] 测试冲突

---
 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 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 c782aa6..31a6248 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
@@ -1027,6 +1027,34 @@
 		}
 		return new String(buf);
 	}
+	/**
+	 * 灏哹yte[]杞崲涓�16杩涘埗瀛楃涓�
+	 *
+	 * @param bytes 寰呰浆鎹yte[]
+	 * @return 杩斿洖 杞崲鍚庣殑瀛楃涓�
+	 */
+	public static String bytesToHex(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);
+	}
 
 	/**
 	 * 灏�16杩涘埗瀛楃涓茶浆鎹负byte[]
@@ -1458,6 +1486,7 @@
 //		System.out.println(v5);
 //
 //	}
+	/*
 	public static void main(String[] args) throws Exception {
 		byte[] bs = new byte[]{0x38, 0x36, 0x39, 0x31} ; 
 		String s = bytes2String_BE(bs, 0, 3) ;
@@ -1471,5 +1500,6 @@
 		}
 		System.out.println(v);
 	}
+	*/
 	
 }

--
Gitblit v1.8.0