Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > conversions

Thread Tools


A n A n D
Posts: n/a
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.



Reply With Quote
Roedy Green
Posts: n/a
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 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 for The Java Glossary.
Reply With Quote

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 C Programming 10 08-05-2005 09:51 AM
Type Conversions Weaam Attallah VHDL 1 11-18-2003 10:13 AM
Access db to data type conversions? Brian Henry ASP .Net 2 10-13-2003 02:38 PM
conversions Max VHDL 0 09-11-2003 07:32 AM