dev@glassfish.java.net

Re: code review needed - new local authentication mechanism

From: Peter Williams <Pete.Williams_at_Sun.COM>
Date: Mon, 17 Aug 2009 18:33:35 -0700

Bill Shannon wrote:
> Kin-man Chung wrote on 08/17/09 17:19:
>>
>>> > 2. Isn't there already a toHex() somewhere in common-util?
>>> Seems like a shame to not put it into a shared place and/or use one
>>> we already have.
>>>
>>> Find me one and I'll use it!
>>>
>>
>> You can use Character.forDigit(b, 16) to convert a byte to char, but it
>> may not be more efficient than what you have. :-)
>
> That just replaces the array and array subscripting. Not a big
> improvement,
> and probably not more efficient. I could probably use String.format
> too, but...
You can also do "new BigInteger(bytes).toString(16)", but it's horribly
inefficient compared to what you have and doesn't quite work right (can
be fixed but still...)

Lloyd's suggestion to add your version to common-util makes the most
sense to me.

-Peter

>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>