File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes change java byte to unsigned Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "change java byte to unsigned" Watch "change java byte to unsigned" New topic
Author

change java byte to unsigned

sweety mehra
Greenhorn

Joined: Feb 09, 2007
Posts: 9
Since java byte is signed, so is there any method to change java byte to unsigned
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
Well, there aren't any unsigned types in Java, so what do you mean?

When you assign an integral type to a larger integral type, Java will sign-extend it. If you then zero-out the higher-order bits, then you have an integer with the value that would have been represented by the smaller type, if it were unsigned.

Example:


Is that what you meant?
[ February 12, 2007: Message edited by: Peter Chase ]

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: change java byte to unsigned
 
Similar Threads
final variable.
Bitwise OR
Convert small C routine to Java
Reading unicode characters from a file
shift operators and hex...HELP!!!!!