tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Tomcat <>
Subject Signed vs. unsigned ints in Java
Date Wed, 19 Jun 2002 01:20:31 GMT
I hope I will be forgiven if this is more of a java question than a Tomcat 

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.


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message