aspose file tools*
The moose likes Java in General and the fly likes Overflow of byte Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Overflow of byte" Watch "Overflow of byte" New topic
Author

Overflow of byte

Robert Ziel
Greenhorn

Joined: Apr 22, 2002
Posts: 28
hi,
can someone explain to me when a byte flows over
it turns negative .. ???
thanks,
Robert
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Robert,
A byte is an 8 bit integer data type. The possible range of the value of a byte is -128 to 127. Let's consider adding one to the bit representation of the maximum value of 127:

Now, mosey on over to The JavaRanch Campfire and learn all about Cat and Mouse Games with Bits!
Good Luck.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
Dirk, it looks like your binary addition could use a little help.

Just wanted to clear that up.
Corey


SCJP Tipline, etc.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Hey, it was early in the morning. You should have seen the first draft - it was worse.
Thanks Corey.
Robert Ziel
Greenhorn

Joined: Apr 22, 2002
Posts: 28
Thanks guys,
this clears it up...
Robert
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Overflow of byte