Not sure, if I understand you correctly, but why use a BigInteger or even C++ at all?
The thread you replied to was quite long already, and I think there were a couple
of alternatives posted in it to do this rather simple task (byte[] -> hexstring)
in a loop, even without BigInteger.
Anyway, in C++ you would either pass the length of the array as a separate
argument, or create a wrapper class that packs pointer and length into one
entity (thus, mimicking Java).
Hi
in c++ ,there is no val.length to check the size of val similar to Binint(byte [] val) in java, can anybody let me know,please,what exactly I need to do.
Regards
Aydin
Hi,
I try to convert a byte array to a hex string like this:
private static String hex_encode (byte [] val)
{
BigInteger b = new BigInteger(val);
String t = b.toString(16);
return (t);
}
For a long byte array it returns a "negative" hex string, i. e. starting
with a "-" sign.
But I want just the bytes in the array converted to hex representation,
each one ranging from "00" to "FF". There should be no minus sign then.
Can you help?
Thanks!
Laura