This week's book giveaway is in the Servlets forum. We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line! See this thread for details.

Signed numbers use the leftmost bit to represent the sign and the remaining bits to represent the magnitude. Unsigned numbers use all the bits to represent the magnitude of the number. long and short just indicate the size (number of bits) of the bit pattern used to represent a number. long has more bits (64)while short has fewer bits (16). Java primitive integral data types are all signed with the exception of char (for which a sign has no meaning anyway).

[This message has been edited by JUNILU LACAR (edited June 22, 2001).]

Can you please give me one example please? Thanks Angela

Originally posted by JUNILU LACAR: Signed numbers use the leftmost bit to represent the sign and the remaining bits to represent the magnitude. Unsigned numbers use all the bits to represent the magnitude of the number. long and short just indicate the size (number of bits) of the bit pattern used to represent a number. long has more bits (64)while short has fewer bits (16). Java primitive integral data types are all signed with the exception of char (for which a sign has no meaning anyway). [This message has been edited by JUNILU LACAR (edited June 22, 2001).]

See the campfire story http://www.javaranch.com/campfire/StoryBits.jsp Angela, the Internet is chock-full of articles that I'm sure could explain the basics of bits and bytes better than anyone could in a single post. Bring up your favorite search engine--mine is http://www.google.com --and type in "bits and bytes" and you should come up with more than enough information. Google has a link to just the article you need in the very first page it lists. Sorry if this seems curt but I think that sometimes folks just have to learn how to help themselves. Best regards, Junilu

short i = 10; long j = 10; They both represent numbers. The difference is the amount of space they take up in memory. Consider the binary form of these numbers: i = 00000000 00001010 (16 bits) j = 00000000 00000000 00000000 00001010 (64 bits)

The difference between a signed and an unsigned version of a variable is wether they allow negatives or not. a signed byte for instans has the range between -128 and 127, while the unsigned version of it has the range between 0 and 255. Making a variable unsigned means that the entire variable (all it's bits) are used for positive values. ok? /Mike