Class Util

java.lang.Object
org.stellar.sdk.Util

public class Util extends Object
Utility class for common operations.

note: For some reason we need to make it public, but I don't recommend to use it directly.

  • Field Details

    • HEX_ARRAY

      public static final char[] HEX_ARRAY
  • Constructor Details

    • Util

      public Util()
  • Method Details

    • bytesToHex

      public static String bytesToHex(byte[] bytes)
      Returns hex representation of bytes array.
      Parameters:
      bytes - byte array to convert to hex
      Returns:
      hex representation of the byte array
    • hexToBytes

      public static byte[] hexToBytes(String s)
      Returns byte array representation of hex string.
      Parameters:
      s - hex string to convert to byte array
      Returns:
      byte array representation of the hex string
    • hash

      public static byte[] hash(byte[] data)
      Returns SHA-256 hash of data.
      Parameters:
      data - byte array to hash
      Returns:
      SHA-256 hash of the data
    • getSdkVersion

      public static String getSdkVersion()
      Get the version of the SDK
      Returns:
      version
    • assertNonNativeAsset

      public static AssetTypeCreditAlphaNum assertNonNativeAsset(Asset asset)
      Throws IllegalArgumentException if the given asset is native (XLM).
      Parameters:
      asset - The asset to check
    • getBytes

      public static byte[] getBytes(BigInteger value)
      Returns an 8 byte array representation of a BigInteger value.
      Parameters:
      value - BigInteger value to convert to byte array
      Returns:
      byte array