This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell 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


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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: readShort vs readUnsignedShort()