liurunyu
2024-07-11 b6833ab41416dd68a30f7cd368a802aa3a0a2e21
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java
@@ -1035,6 +1035,31 @@
       return fromIndex ;
   }
   /**
    * 十六进制转字节数组
    * @param hex the hex string
    * @return 返回 byte[]
    */
   public static int hex2Bytes_LE(String hex, byte[] bs, int fromIndex) {
      if (hex == null || hex.equals("")) {
         return fromIndex;
      }
      hex = hex.toUpperCase(Locale.ENGLISH);
      int length = hex.length() / 2;
      char[] hexChars = hex.toCharArray();
      byte[] d = new byte[length];
      for (int i = 0; i < length; i++) {
         int pos = i * 2;
         d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1]));
      }
      for(int i = 0 ; i < d.length; i++){
         bs[fromIndex++] = d[(d.length - 1) - i] ;
      }
      return fromIndex ;
   }
   private static final char[] HEX_CHAR = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
//   /**
//    * 将byte[]转换为16进制字符串