> Thats cool!! > > Then why we need getUnsignedByte() itself?? > eg: to read a byte read 0xff , get its unsigned value by typcasting to > int i,e 0x000000ff; > & to write it back just write the byte 0xff.
The byte 0xff is equal to -1 so when you cast it to an int you end up with an int that is equal to -1 (0xffffffff). We want an int that is equal to 255. When you cast from a smaller precision number to a larger precision number (byte->int) the JVM will always preserve the sign. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
