Administrator
2024-07-16 ee711d38f66222915bc81332c98af677fa5cd96c
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java
@@ -511,9 +511,9 @@
         for (int i = 0; i < 4; i++) {
            bs[from + i] = Integer.valueOf(value & 0xff).byteValue();// 将最低位保存在低字节
            value = value >> 8; // 向右移8位
         if(value == 0){
            break ;
         }
            if(value == 0){
               break ;
            }
         }
      } else {
         throw new Exception("int2Bytes时数组越界");
@@ -1210,6 +1210,31 @@
   }
   /**
    * 小端模式《数据低位在数组低字节》
    * 整形转成BCD编码,字节顺序是倒的
    * @param i
    * @param bs
    * @param from
    * @return 返回
    */
   public static void int2BCD_LE(int i, byte[] bs, int from)throws Exception {
      String str = "" + i;
      byte[] b = null;
      if (str.length() % 2 == 0) {
         b = new byte[str.length() / 2];
      } else {
         b = new byte[(str.length() / 2) + 1];
      }
      encodeBCD_LE(str, b, 0, b.length);
      int len = bs.length ;
      int bLen = b.length ;
      for(int j = 0; (j < len && j < bLen); j++){
         bs[from + j] = b[j] ;
      }
   }
   /**
    * 大端模式《数据低位在数组高字节》
    * 长整形转成BCD编码
    * @param l