B4J Code Snippet java.util.HexFormat (Java 17+)

Nifty little class - turns numbers into hex strings and vice versa
B4X:
Dim hx As JavaObject
hx = hx.InitializeStatic("java.util.HexFormat").RunMethodJO("of",Null).RunMethod("withUpperCase",Null)

Then use like
B4X:
Dim a As Int = 12345
log(hx.RunMethod("toHexDigits",array(a)))  '-> to hex string

Lots of other useful methods like hex string to byte array.

Ref: HexFormat
 
Top