I use Java8 and I wonder if Java8 has an equivalent method to org.apache.commons.codec.Hex.encodeHexString
Thanks!
Integer.toHexString(int)
is available. As is BigInteger.toString(int radix)
. Both can encode to hex.
It is hard to tell what you really need without seeing example of input and expected output, but based on your comment under @Elliott's answer:
Hex.encodeHexString() - input is a byte[] and output is String.
you may be looking for HexBinaryAdapter
class and its
String marshal(byte[] bytes)
byte[] unmarshal(String s)
methods (although they are non-static so you will need instance of this adapter).
They internally invoke these static methods:
DatatypeConverter.printHexBinary(bytes)
DatatypeConverter.parseHexBinary(s)
So you may want to take a look at DatatypeConverter class.