com.digi.xbee.api.utils

## Class HexUtils

- java.lang.Object
- - com.digi.xbee.api.utils.HexUtils

-     public class HexUtils
      extends Object

  Utility class containing methods to work with hexadecimal values and several data type conversions.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HexUtils()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `byteArrayToHexString(byte[] value)` Converts the given byte array into an hex string.
    `static String` | `byteToHexString(byte value)` Converts the given byte into an hex string.
    `static boolean` | `containsLetters(String parameter)` Checks whether the given parameter is a string or a numeric value.
    `static byte[]` | `hexStringToByteArray(String value)` Converts the given hex string into a byte array.
    `static String` | `integerToHexString(int value, int minBytes)` Converts the given integer into an hexadecimal string.
    `static String` | `prettyHexString(byte[] value)` Converts the given byte array into an hex string and retrieves it in pretty format by splitting the content byte by byte.
    `static String` | `prettyHexString(String hexString)` Converts the given hexadecimal string to a pretty format by splitting the content byte by byte.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### HexUtils

          public HexUtils()

  - ### Method Detail

    - #### byteArrayToHexString

          public static String byteArrayToHexString(byte[] value)

      Converts the given byte array into an hex string.
      Parameters:
        `value` - Byte array to convert to hex string.
      Returns:
        Converted byte array to hex string.
      Throws:
        `NullPointerException` - if `value == null`.
      See Also:
        `hexStringToByteArray(String)`

    - #### byteToHexString

          public static String byteToHexString(byte value)

      Converts the given byte into an hex string.
      Parameters:
        `value` - Byte to convert to hex string.
      Returns:
        Converted byte to hex string.

    - #### containsLetters

          public static boolean containsLetters(String parameter)

      Checks whether the given parameter is a string or a numeric value.
      Parameters:
        `parameter` - Parameter to check.
      Returns:
        `true` if the given parameter is a string, `false` otherwise.
      Throws:
        `NullPointerException` - if `parameter == null`.

    - #### hexStringToByteArray

          public static byte[] hexStringToByteArray(String value)

      Converts the given hex string into a byte array.
      Parameters:
        `value` - Hex string to convert to byte array.
      Returns:
        Byte array of the given hex string.
      Throws:
        `NullPointerException` - if `value == null`.
      See Also:
        `byteArrayToHexString(byte[])`

    - #### integerToHexString

          public static String integerToHexString(int value,
                                  int minBytes)

      Converts the given integer into an hexadecimal string.
      Parameters:
        `value` - The integer value to convert to hexadecimal string.
        `minBytes` - The minimum number of bytes to be represented.
      Returns:
        The integer value as hexadecimal string.

    - #### prettyHexString

          public static String prettyHexString(byte[] value)

      Converts the given byte array into an hex string and retrieves it in pretty format by splitting the content byte by byte.
      Parameters:
        `value` - The byte array to convert to pretty hex string.
      Returns:
        The hexadecimal pretty string.
      Throws:
        `NullPointerException` - if `value == null`.
      See Also:
        `prettyHexString(String)`

    - #### prettyHexString

          public static String prettyHexString(String hexString)

      Converts the given hexadecimal string to a pretty format by splitting the content byte by byte.
      Parameters:
        `hexString` - The hexadecimal string to convert.
      Returns:
        The hexadecimal string with pretty format.
      Throws:
        `NullPointerException` - if `hexString == null`.
      See Also:
        `prettyHexString(byte[])`

© Copyright 2014–2014 Digi International Inc. All rights reserved.