Top Description Constructors Methods
org.droidparts.dexmaker.dx.util

public final Class Hex

extends Object
Class Inheritance

Utilities for formatting numbers as hexadecimal.

Constructor Summary

AccessConstructor and Description
private
Hex()

This class is uninstantiable.

Method Summary

Modifier and TypeMethod and Description
public static String

Returns:

non-null; a string of the dump
dump
(byte[]
non-null; array to format
arr
,
int
>= 0; offset to the part to dump
offset
,
int
>= 0; number of bytes to dump
length
,
int
>= 0; first output offset to print
outOffset
,
int
>= 0; number of bytes of output per line
bpl
,
int
{2,4,6,8}; number of characters for each address header
addressLength
)

Formats a hex dump of a portion of a byte[].

public static String

Returns:

non-null; formatted form
s1
(int
value to format
v
)

Formats an int as a 1-byte signed hex value.

public static String

Returns:

non-null; formatted form
s2
(int
value to format
v
)

Formats an int as a 2-byte signed hex value.

public static String

Returns:

non-null; formatted form
s4
(int
value to format
v
)

Formats an int as a 4-byte signed hex value.

public static String

Returns:

non-null; formatted form
s8
(long
value to format
v
)

Formats a long as an 8-byte signed hex value.

public static String

Returns:

non-null; formatted form
u1
(int
value to format
v
)

Formats an int as a 1-byte unsigned hex value.

public static String

Returns:

non-null; formatted form
u2
(int
value to format
v
)

Formats an int as a 2-byte unsigned hex value.

public static String

Returns:

non-null; formatted form
u2or4
(int
value to format
v
)

Formats an int as either a 2-byte unsigned hex value (if the value is small enough) or a 4-byte unsigned hex value (if not).

public static String

Returns:

non-null; formatted form
u3
(int
value to format
v
)

Formats an int as a 3-byte unsigned hex value.

public static String

Returns:

non-null; formatted form
u4
(int
value to format
v
)

Formats an int as a 4-byte unsigned hex value.

public static String

Returns:

non-null; formatted form
u8
(long
value to format
v
)

Formats a long as an 8-byte unsigned hex value.

public static String

Returns:

non-null; formatted form
uNibble
(int
value to format
v
)

Formats an int as a 4-bit unsigned hex nibble.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Hexback to summary
private Hex()

This class is uninstantiable.

Method Detail

dumpback to summary
public static String dump(byte[] arr, int offset, int length, int outOffset, int bpl, int addressLength)

Formats a hex dump of a portion of a byte[]. The result is always newline-terminated, unless the passed-in length was zero, in which case the result is always the empty string ("").

Parameters
arr:byte[]

non-null; array to format

offset:int

>= 0; offset to the part to dump

length:int

>= 0; number of bytes to dump

outOffset:int

>= 0; first output offset to print

bpl:int

>= 0; number of bytes of output per line

addressLength:int

{2,4,6,8}; number of characters for each address header

Returns:String

non-null; a string of the dump

s1back to summary
public static String s1(int v)

Formats an int as a 1-byte signed hex value.

Parameters
v:int

value to format

Returns:String

non-null; formatted form

s2back to summary
public static String s2(int v)

Formats an int as a 2-byte signed hex value.

Parameters
v:int

value to format

Returns:String

non-null; formatted form

s4back to summary
public static String s4(int v)

Formats an int as a 4-byte signed hex value.

Parameters
v:int

value to format

Returns:String

non-null; formatted form

s8back to summary
public static String s8(long v)

Formats a long as an 8-byte signed hex value.

Parameters
v:long

value to format

Returns:String

non-null; formatted form

u1back to summary
public static String u1(int v)

Formats an int as a 1-byte unsigned hex value.

Parameters
v:int

value to format

Returns:String

non-null; formatted form

u2back to summary
public static String u2(int v)

Formats an int as a 2-byte unsigned hex value.

Parameters
v:int

value to format

Returns:String

non-null; formatted form

u2or4back to summary
public static String u2or4(int v)

Formats an int as either a 2-byte unsigned hex value (if the value is small enough) or a 4-byte unsigned hex value (if not).

Parameters
v:int

value to format

Returns:String

non-null; formatted form

u3back to summary
public static String u3(int v)

Formats an int as a 3-byte unsigned hex value.

Parameters
v:int

value to format

Returns:String

non-null; formatted form

u4back to summary
public static String u4(int v)

Formats an int as a 4-byte unsigned hex value.

Parameters
v:int

value to format

Returns:String

non-null; formatted form

u8back to summary
public static String u8(long v)

Formats a long as an 8-byte unsigned hex value.

Parameters
v:long

value to format

Returns:String

non-null; formatted form

uNibbleback to summary
public static String uNibble(int v)

Formats an int as a 4-bit unsigned hex nibble.

Parameters
v:int

value to format

Returns:String

non-null; formatted form