public class

Hex

extends Object
java.lang.Object
   ↳ com.facebook.common.util.Hex

Class Overview

Basic hex operations: from byte array to string and vice versa.

TODO: move to the framework and consider implementing as native code.

Summary

Public Constructors
Hex()
Public Methods
static String byte2Hex(int value)
Convert an int [0-255] to a hexadecimal string representation.
static byte[] decodeHex(String hexString)
Quickly converts a hexadecimal string to a byte array.
static String encodeHex(byte[] array, boolean zeroTerminated)
Quickly converts a byte array to a hexadecimal string representation.
static byte[] hexStringToByteArray(String s)
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Hex ()

Public Methods

public static String byte2Hex (int value)

Convert an int [0-255] to a hexadecimal string representation.

Parameters
value int value.

public static byte[] decodeHex (String hexString)

Quickly converts a hexadecimal string to a byte array.

public static String encodeHex (byte[] array, boolean zeroTerminated)

Quickly converts a byte array to a hexadecimal string representation.

Parameters
array byte array, possibly zero-terminated.

public static byte[] hexStringToByteArray (String s)