类 HexUtil

java.lang.Object
com.xiaoTools.util.hexUtil.HexUtil

public class HexUtil
extends Object
[16进制工具](Hex tool)
从以下版本开始:
2021/5/15 12:10 下午
作者:
XiaoXunYao
  • 构造器概要

    构造器
    构造器 说明
    HexUtil()
    [初始化项目](Initialize project)
  • 方法概要

    修饰符和类型 方法 说明
    static void appendHex​(StringBuilder builder, byte b, boolean toLowerCase)
    [将byte值转为16进制并添加到StringBuilder中](Convert the byte value to hexadecimal and add it to StringBuilder)
    static Color decodeColor​(String hexColor)
    [将Hex颜色值转为Color](Convert hex color value to color)
    static byte[] decodeHex​(char[] hexData)
    [将十六进制字符数组转换为字节数组](Converts a hexadecimal character array to a byte array)
    static byte[] decodeHex​(String hexStr)
    [将十六进制字符串解码为byte[]](Decode hexadecimal string to byte [])
    static String decodeHexStr​(char[] hexData, Charset charset)
    [将十六进制字符数组转换为字符串](Converts a hexadecimal character array to a string)
    static String decodeHexStr​(String hexStr)
    [将十六进制字符数组转换为字符串,默认编码UTF-8](Convert hexadecimal character array to string, default encoding UTF-8)
    static String decodeHexStr​(String hexStr, Charset charset)
    [将十六进制字符数组转换为字符串](Converts a hexadecimal character array to a string)
    static String encodeColor​(Color color)
    [将Color编码为Hex形式](Encode color to hex form)
    static String encodeColor​(Color color, String prefix)
    [将Color编码为Hex形式](Encode color to hex form)
    static char[] encodeHex​(byte[] data)
    [将字节数组转换为十六进制字符数组](Convert byte array to hexadecimal character array)
    static char[] encodeHex​(byte[] data, boolean toLowerCase)
    [将字节数组转换为十六进制字符数组](Convert byte array to hexadecimal character array)
    static char[] encodeHex​(String str, Charset charset)
    [将字节数组转换为十六进制字符数组](Convert byte array to hexadecimal character array)
    static String encodeHexStr​(byte[] data)
    [将字节数组转换为十六进制字符串](Converts a byte array to a hexadecimal string)
    static String encodeHexStr​(byte[] data, boolean toLowerCase)
    [将字节数组转换为十六进制字符串](Converts a byte array to a hexadecimal string)
    static String encodeHexStr​(String data)
    [将字符串转换为十六进制字符串,结果为小写](Converts a string to a hexadecimal string and the result is lowercase)
    static String encodeHexStr​(String data, Charset charset)
    [将字符串转换为十六进制字符串,结果为小写](Converts a string to a hexadecimal string and the result is lowercase)
    static String format​(String hexStr)
    [格式化Hex字符串](Format hex string)
    static boolean isHexNumber​(String value)
    [判断给定字符串是否为16进制数](Determine whether the given string is a hexadecimal number)
    static BigInteger toBigInteger​(String hexStr)
    [Hex(16进制)字符串转为BigInteger](Hex (hexadecimal) string to BigInteger)
    static String toHex​(int value)
    [转为16进制字符串](Convert to hexadecimal string)
    static String toHex​(long value)
    [转为16进制字符串](Convert to hexadecimal string)
    static String toUnicodeHex​(char ch)
    [将指定char值转换为Unicode字符串形式](Converts the specified char value to unicode string form)
    static String toUnicodeHex​(int value)
    [将指定int值转换为Unicode字符串形式](Converts the specified int value to a Unicode string)

    从类继承的方法 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 构造器详细资料

    • HexUtil

      public HexUtil()
      [初始化项目](Initialize project)
      从以下版本开始:
      2021/5/15 12:11 下午
  • 方法详细资料

    • isHexNumber

      public static boolean isHexNumber​(String value)
      [判断给定字符串是否为16进制数](Determine whether the given string is a hexadecimal number)
      参数:
      value - : 值
      返回:
      boolean
      从以下版本开始:
      2021/6/30 7:55 上午
    • encodeHex

      public static char[] encodeHex​(byte[] data)
      [将字节数组转换为十六进制字符数组](Convert byte array to hexadecimal character array)
      参数:
      data - : byte[]
      返回:
      char[]
      从以下版本开始:
      2021/6/30 7:58 上午
    • encodeHex

      public static char[] encodeHex​(String str, Charset charset)
      [将字节数组转换为十六进制字符数组](Convert byte array to hexadecimal character array)
      参数:
      str - : 字符串
      charset - : 编码
      返回:
      char[]
      从以下版本开始:
      2021/6/30 8:01 上午
    • encodeHex

      public static char[] encodeHex​(byte[] data, boolean toLowerCase)
      [将字节数组转换为十六进制字符数组](Convert byte array to hexadecimal character array)
      参数:
      data - : byte[]
      toLowerCase - : true 传换成小写格式 , false 传换成大写格式
      返回:
      char[]
      从以下版本开始:
      2021/6/30 8:02 上午
    • encodeHexStr

      public static String encodeHexStr​(String data, Charset charset)
      [将字符串转换为十六进制字符串,结果为小写](Converts a string to a hexadecimal string and the result is lowercase)
      参数:
      data - : 需要被编码的字符串
      charset - : 编码
      返回:
      java.lang.String
      从以下版本开始:
      2021/6/30 7:48 上午
    • encodeHexStr

      public static String encodeHexStr​(String data)
      [将字符串转换为十六进制字符串,结果为小写](Converts a string to a hexadecimal string and the result is lowercase)
      参数:
      data - : 被编码的字符串
      返回:
      java.lang.String
      从以下版本开始:
      2021/6/30 9:33 下午
    • encodeHexStr

      public static String encodeHexStr​(byte[] data)
      [将字节数组转换为十六进制字符串](Converts a byte array to a hexadecimal string)
      参数:
      data - : byte[]
      返回:
      java.lang.String
      从以下版本开始:
      2021/7/3 8:03 上午
    • encodeHexStr

      public static String encodeHexStr​(byte[] data, boolean toLowerCase)
      [将字节数组转换为十六进制字符串](Converts a byte array to a hexadecimal string)
      参数:
      data - : byte[]
      toLowerCase - : true 传换成小写格式 , false 传换成大写格式
      返回:
      java.lang.String
      从以下版本开始:
      2021/6/30 9:34 下午
    • decodeHexStr

      public static String decodeHexStr​(String hexStr)
      [将十六进制字符数组转换为字符串,默认编码UTF-8](Convert hexadecimal character array to string, default encoding UTF-8)
      参数:
      hexStr - : 十六进制String
      返回:
      java.lang.String
      从以下版本开始:
      2021/7/1 7:50 上午
    • decodeHexStr

      public static String decodeHexStr​(String hexStr, Charset charset)
      [将十六进制字符数组转换为字符串](Converts a hexadecimal character array to a string)
      参数:
      hexStr - : 十六进制String
      charset - : 编码
      返回:
      java.lang.String
      从以下版本开始:
      2021/7/1 7:51 上午
    • decodeHexStr

      public static String decodeHexStr​(char[] hexData, Charset charset)
      [将十六进制字符数组转换为字符串](Converts a hexadecimal character array to a string)
      参数:
      hexData - : 十六进制char[]
      charset - : 编码
      返回:
      java.lang.String
      从以下版本开始:
      2021/7/1 7:52 上午
    • decodeHex

      public static byte[] decodeHex​(char[] hexData)
      [将十六进制字符数组转换为字节数组](Converts a hexadecimal character array to a byte array)
      参数:
      hexData - : 十六进制char[]
      返回:
      byte[]
      从以下版本开始:
      2021/7/1 7:54 上午
    • decodeHex

      public static byte[] decodeHex​(String hexStr)
      [将十六进制字符串解码为byte[]](Decode hexadecimal string to byte [])
      参数:
      hexStr - : 十六进制String
      返回:
      byte[]
      从以下版本开始:
      2021/7/1 7:58 上午
    • encodeColor

      public static String encodeColor​(Color color)
      [将Color编码为Hex形式](Encode color to hex form)
      参数:
      color - : Color
      返回:
      java.lang.String
      从以下版本开始:
      2021/7/1 7:59 上午
    • encodeColor

      public static String encodeColor​(Color color, String prefix)
      [将Color编码为Hex形式](Encode color to hex form)
      参数:
      color - : Color
      prefix - : 前缀字符串,可以是#、0x等
      返回:
      java.lang.String
      从以下版本开始:
      2021/7/1 8:03 上午
    • decodeColor

      public static Color decodeColor​(String hexColor)
      [将Hex颜色值转为Color](Convert hex color value to color)
      参数:
      hexColor - : 16进制颜色值,可以以#开头,也可以用0x开头
      返回:
      java.awt.Color
      从以下版本开始:
      2021/7/1 8:04 上午
    • toUnicodeHex

      public static String toUnicodeHex​(int value)
      [将指定int值转换为Unicode字符串形式](Converts the specified int value to a Unicode string)
      参数:
      value - : int值,也可以是char
      返回:
      java.lang.String
      从以下版本开始:
      2021/7/1 8:31 上午
    • toUnicodeHex

      public static String toUnicodeHex​(char ch)
      [将指定char值转换为Unicode字符串形式](Converts the specified char value to unicode string form)
      参数:
      ch - : char值
      返回:
      java.lang.String
      从以下版本开始:
      2021/7/3 7:48 上午
    • toHex

      public static String toHex​(int value)
      [转为16进制字符串](Convert to hexadecimal string)
      参数:
      value - : int value
      返回:
      java.lang.String
      从以下版本开始:
      2021/7/3 7:50 上午
    • toHex

      public static String toHex​(long value)
      [转为16进制字符串](Convert to hexadecimal string)
      参数:
      value - : long value
      返回:
      java.lang.String
      从以下版本开始:
      2021/7/3 7:50 上午
    • appendHex

      public static void appendHex​(StringBuilder builder, byte b, boolean toLowerCase)
      [将byte值转为16进制并添加到StringBuilder中](Convert the byte value to hexadecimal and add it to StringBuilder)
      参数:
      builder - : StringBuilder
      b - : byte
      toLowerCase - : 是否使用小写
      从以下版本开始:
      2021/7/3 7:54 上午
    • toBigInteger

      public static BigInteger toBigInteger​(String hexStr)
      [Hex(16进制)字符串转为BigInteger](Hex (hexadecimal) string to BigInteger)
      参数:
      hexStr - : Hex(16进制字符串)
      返回:
      java.math.BigInteger
      从以下版本开始:
      2021/7/3 7:56 上午
    • format

      public static String format​(String hexStr)
      [格式化Hex字符串](Format hex string)
      参数:
      hexStr - : Hex字符串
      返回:
      java.lang.String
      从以下版本开始:
      2021/7/3 7:59 上午