jiazx0107@163.com
2023-12-24 8efb5a8cd2c8a6b40e58f4f3fb851d54cf415af9
src/main/java/com/fzzy/api/utils/BytesUtil.java
@@ -320,29 +320,6 @@
      return String.format("%04x", num).toUpperCase();
   }
   // 计算16进制对应的数值
   public static int GetHex(char ch) throws Exception {
      if (ch >= '0' && ch <= '9')
         return (int) (ch - '0');
      if (ch >= 'a' && ch <= 'f')
         return (int) (ch - 'a' + 10);
      if (ch >= 'A' && ch <= 'F')
         return (int) (ch - 'A' + 10);
      throw new Exception("error param");
   }
   // 计算幂
   public static int GetPower(int nValue, int nCount) throws Exception {
      if (nCount < 0)
         throw new Exception("nCount can't small than 1!");
      if (nCount == 0)
         return 1;
      int nSum = 1;
      for (int i = 0; i < nCount; ++i) {
         nSum = nSum * nValue;
      }
      return nSum;
   }
   public static void main(String[] args) {
      
@@ -353,6 +330,7 @@
      System.out.println(d2);
      
      System.out.println(d1 + d2);
      
   }
@@ -461,4 +439,12 @@
      }
      return biannary2Decimal(two) + 1;
   }
   public static String byteToHex(byte b) {
      String hex = Integer.toHexString(b & 0xFF);
      if (hex.length() < 2) {
         hex = "0" + hex;
      }
      return hex;
   }
}