From b27d0ba5ab7a11ac6615e0cfee3cf428a7ae834f Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期三, 29 五月 2024 08:56:34 +0800 Subject: [PATCH] 完善代码 --- pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java | 64 ++++++++++++++++---------------- 1 files changed, 32 insertions(+), 32 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 ee7b49d..f2e5c50 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 @@ -310,7 +310,7 @@ long l = 0; long[] ls = new long[len] ; for(int i = 0 ; i < len; i++){ - ls[i] = bs[i] ; + ls[i] = bs[i] & 0xFF ; } for(int i = len-1 ; i >= 0; i--){ ls[(len - 1) - i] <<= 8 * i ; @@ -334,14 +334,14 @@ boolean b = isOutOfArrLength(bs.length, (from - 1) + 8); if (b) { long s = 0; - long s0 = bs[from + 0] ;// 鏈�浣庝綅 - long s1 = bs[from + 1] ; - long s2 = bs[from + 2] ; - long s3 = bs[from + 3] ; - long s4 = bs[from + 4] ; - long s5 = bs[from + 5] ; - long s6 = bs[from + 6] ; - long s7 = bs[from + 7] ; + long s0 = bs[from + 0] & 0xFF ;// 鏈�浣庝綅 + long s1 = bs[from + 1] & 0xFF ; + long s2 = bs[from + 2] & 0xFF ; + long s3 = bs[from + 3] & 0xFF ; + long s4 = bs[from + 4] & 0xFF ; + long s5 = bs[from + 5] & 0xFF ; + long s6 = bs[from + 6] & 0xFF ; + long s7 = bs[from + 7] & 0xFF ; // s7涓嶅彉 s6 <<= 8; @@ -371,7 +371,7 @@ short len = (short)(end - from + 1) ; long[] ls = new long[len] ; for(short i = 0 ; i < len; i++){ - ls[i] = bs[from + i] ; + ls[i] = bs[from + i] & 0xFF ; } for(short i = (short)(len-1) ; i >= 0; i--){ ls[i] <<= 8 * (len - (i + 1)) ; @@ -400,7 +400,7 @@ long l = 0; long[] ls = new long[len] ; for(int i = 0 ; i < len; i++){ - ls[i] = bs[i] ; + ls[i] = bs[i] & 0xFF ; } for(int i = 0 ; i < len; i++){ ls[(len - 1) - i] <<= 8 * i ; @@ -424,14 +424,14 @@ boolean b = isOutOfArrLength(bs.length, (from - 1) + 8); if (b) { long s = 0; - long s0 = bs[from] ;// 鏈�浣庝綅 - long s1 = bs[from + 1] ; - long s2 = bs[from + 2] ; - long s3 = bs[from + 3] ; - long s4 = bs[from + 4] ; - long s5 = bs[from + 5] ; - long s6 = bs[from + 6] ; - long s7 = bs[from + 7] ; + long s0 = bs[from] & 0xFF ;// 鏈�浣庝綅 + long s1 = bs[from + 1] & 0xFF ; + long s2 = bs[from + 2] & 0xFF ; + long s3 = bs[from + 3] & 0xFF ; + long s4 = bs[from + 4] & 0xFF ; + long s5 = bs[from + 5] & 0xFF ; + long s6 = bs[from + 6] & 0xFF ; + long s7 = bs[from + 7] & 0xFF ; // s0涓嶅彉 s1 <<= 8; @@ -462,7 +462,7 @@ short len = (short)(end - from + 1) ; long[] ls = new long[len] ; for(short i = 0 ; i < len; i++){ - ls[i] = bs[from + i] ; + ls[i] = bs[from + i] & 0xFF ; } for(short i = 0 ; i < len; i++){ ls[i] <<= 8 * i ; @@ -531,10 +531,10 @@ boolean b = isOutOfArrLength(bs.length, (from - 1) + 4); if (b) { int s = 0; - int s0 = bs[from + 0] ;// 鏈�浣庝綅 - int s1 = bs[from + 1] ; - int s2 = bs[from + 2] ; - int s3 = bs[from + 3] ; + int s0 = bs[from + 0] & 0xFF ;// 鏈�浣庝綅 + int s1 = bs[from + 1] & 0xFF ; + int s2 = bs[from + 2] & 0xFF ; + int s3 = bs[from + 3] & 0xFF ; // s3涓嶅彉 s2 <<= 8; @@ -558,10 +558,10 @@ boolean b = isOutOfArrLength(bs.length, (from - 1) + 4); if (b) { int s = 0; - int s0 = bs[from + 0] ;// 鏈�浣庝綅 - int s1 = bs[from + 1] ; - int s2 = bs[from + 2] ; - int s3 = bs[from + 3] ; + int s0 = bs[from + 0] & 0xFF ;// 鏈�浣庝綅 + int s1 = bs[from + 1] & 0xFF ; + int s2 = bs[from + 2] & 0xFF ; + int s3 = bs[from + 3] & 0xFF ; // s0涓嶅彉 s1 <<= 8; @@ -654,8 +654,8 @@ boolean b = isOutOfArrLength(bs.length, (from - 1) + 2); if (b) { int s = 0; - int s0 = bs[from + 0] ; - int s1 = bs[from + 1] ; + int s0 = bs[from + 0] & 0xFF ; + int s1 = bs[from + 1] & 0xFF ; // s1涓嶅彉 s0 <<= 8; @@ -677,8 +677,8 @@ boolean b = isOutOfArrLength(bs.length, (from - 1) + 2); if (b) { int s = 0; - int s0 = bs[from + 0] ; - int s1 = bs[from + 1] ; + int s0 = bs[from + 0] & 0xFF ; + int s1 = bs[from + 1] & 0xFF ; // s0涓嶅彉 s1 <<= 8; -- Gitblit v1.8.0