tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shilpa Pakdhane" <shilpa.pakdh...@cgijapan.co.jp>
Subject Re: Signed vs. unsigned ints in Java
Date Wed, 19 Jun 2002 02:25:54 GMT
the only way i can think of is using shift operators!

cheers
shlp.

>>> tomcat@mobile.mp 06/19/02 10:20AM >>>
I hope I will be forgiven if this is more of a java question than a Tomcat 
question:

I need to write some code that forms headers for a protocol.  This protocol 
requires specifying certain values as 16 bit unsigned ints, or even 14 bit 
unsigned values.  All the int types in java are signed.  Is there a way that 
I can take a regular 32 bit java int and come up with the string of 16 or 14 
or 4 (depending on which header field) bits that represent that value in an 
unsigned way?

Thanks for help on this.  Java certainly doesn't have the great bit handling 
abilities of C so I'm having a hard time figuring out how to put these binary 
headers together.  But Java is so awesome in every other way compared to C 
that there's no question in my mind about which one to use for pretty much 
any network service.

Thanks!

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>



--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message