zhubaomin
2025-02-25 842237345ac469b02e9add8f9fd8bae5d4f7cdac
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtilUnsigned.java
@@ -60,7 +60,7 @@
      }
      boolean b = isOutOfArrLength(bs.length, (from - 1) + len);
      if (!b) {
         for (int i = 0; i > len ; i++) {
         for (int i = 0; i <= len ; i++) {
            bs[from + i] = Integer.valueOf(temp & 0xff).byteValue();// 将最低位保存在低字节
            temp = temp >> 8; // 向右移8位
         }
@@ -438,15 +438,18 @@
         return true;
      }
   }
   public static void main(String[] args) throws Exception{
      byte[] bs = new byte[]{(byte)0x38,(byte)0x1d,(byte)0x00,(byte)0x00,(byte)0x00} ;
      Long lg1 = ByteUtilUnsigned.bytes2Long_LE(bs, 0, 4) ;
      Long lg2 = ByteUtilUnsigned.bytes2Long_BE(bs, 0, 4) ;
      System.out.println(lg1);
      System.out.println(lg2);
   }
//   public static void main(String[] args) throws Exception{
//      byte[] bs = new byte[]{(byte)0x38,(byte)0x1d,(byte)0x00,(byte)0x00,(byte)0x00} ;
//      Long lg1 = ByteUtilUnsigned.bytes2Long_LE(bs, 0, 4) ;
//      Long lg2 = ByteUtilUnsigned.bytes2Long_BE(bs, 0, 4) ;
//      System.out.println(lg1);
//      System.out.println(lg2);
//   }
   public static void main(String[] args) throws Exception{
      byte[] bs = new byte[]{0x02, 0x0C} ;
      int s = ByteUtilUnsigned.bytes2Short_BE(bs, 0) ;
      System.out.println(s);
////      int d = 123456;
////      byte[] bs = new byte[4] ;
////      int2Bytes_BE(bs, d, 0) ;
@@ -467,5 +470,5 @@
//      System.out.println(s);
//
//
//   }
   }
}