This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv 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 REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "readShort vs readUnsignedShort()" Watch "readShort vs readUnsignedShort()" New topic

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.
[ February 12, 2002: Message edited by: Shivaji Marathe ]
I agree. Here's the link:
subject: readShort vs readUnsignedShort()
It's not a secret anymore!