Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > conversions

Reply
Thread Tools

conversions

 
 
A n A n D
Guest
Posts: n/a
 
      04-21-2004
Hi,
How to convert character into bytes and then back to char ?
I know there is a method ..
public static byte [] charToByteArray( char c ) {

byte [] twoBytes = { (byte)(c & 0xff), (byte)(c >> 8 & 0xff) };

return twoBytes;

}

to convert to bytes. But how can I convert raw bytes back to char.

ALso, how can I do this for int and short as well.

Thanks.

--Anand



 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      04-21-2004
On Wed, 21 Apr 2004 03:33:22 GMT, "A n A n D" <(E-Mail Removed)> wrote
or quoted :

>How to convert character into bytes and then back to char ?


see http://mindprod.com/jgloss/converter.html for all your conversion
needs. I had a fan phone call today for that little Applet.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail database conversions? Wheaty Firefox 8 08-07-2005 03:32 AM
Pointer conversions and Data types conversions vb@gmail.com C Programming 10 08-05-2005 09:51 AM
Type Conversions Weaam Attallah VHDL 1 11-18-2003 10:13 AM
Access db to ado.net data type conversions? Brian Henry ASP .Net 2 10-13-2003 02:38 PM
conversions Max VHDL 0 09-11-2003 07:32 AM



Advertisments