Hi Usha,

    You can do this directly, letting the compiler do the conversion, as


Integer.toHexString(byteVal);  // bytes are signed, max val = 127

Integer.toHexString(charVal)


    See attached program.



                                                            Joe Sam


Joe Sam Shirah
Autumn Software
Consulting/Development Services when YOU need them
___________________________________________

-----Original Message-----
From: X. Amala Sahaya Babu <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Friday, December 31, 1999 1:29 AM
Subject: Re: Conversion to Hexadecimal


>I don't know whether it's an optimised solution.
>
>1. Using String(Char[] value) to convert char into String object.
>2. Then Convert String Object to Long or Integer Object by using
>    Long or Integer Wrapper Class. e.g. Integer.valueOf(String str).
>3. Then using Integer.toHexString(int num) convert that into Hexadecimal.
>    num = Integer.intValue();
>
>    The same way you can use Long also.
>
>Cheers
>
>Babu
>
>----- Original Message -----
>From: Usha Sree Y <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Wednesday, December 29, 1999 11:13 AM
>Subject: Conversion to Hexadecimal
>
>
>could someone tell me how to convert a char or byte to a hexadecimal
>value in Java.
>i am sorry if this is off-topic.
>I have gone through the documentation and found some example but could
>not  understand it.
>

HexToInt.java

Reply via email to