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.
The moose likes Java in General and the fly likes readShort vs readUnsignedShort() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "readShort vs readUnsignedShort()" Watch "readShort vs readUnsignedShort()" New topic
Author

readShort vs readUnsignedShort()

william kane
Ranch Hand

Joined: Nov 21, 2000
Posts: 260
how is readShort() different from readUnsignedShort() when both of them are meant to read data written using writeShort()?


Help me!Help you!!!
Shivaji Marathe
Ranch Hand

Joined: Jan 11, 2002
Posts: 203
readShort can return both the positive and negative values of short.
Readunsingedshort will only return the positive values or rather the absolute values.
Try writing a small program where you write some positive values and some negative values and then try to use readShort and readUnsignedShort to read the positive and negative values.
See what you get.
HTH
[ February 12, 2002: Message edited by: Shivaji Marathe ]
 
Consider Paul's rocket mass heater.
 
subject: readShort vs readUnsignedShort()
 
Similar Threads
B&S: Data File Format
NX: Confused about data format
NX: n bytes numeric - is it unsigned ?
I passed, but I suffered the 44/80 locking penalty. Why?
extracting bytes from byte array