Skip to main content

Timeline for Represent an int as 2 bytes in Java

Current License: CC BY-SA 3.0

5 events
when toggle format what by license comment
Nov 28, 2012 at 19:14 vote accept Igor Atman
Nov 28, 2012 at 19:13 comment added Esailija @IgorAtman the problem has to be elsewhere, if you write raw byte with value of -1 into a file, that file will then contain 0xFF
Nov 28, 2012 at 19:06 comment added Igor Atman @ Esailija: Thank you! You see my problem is that a specific protocol (Modbus) requires me to include this value of FF 00 to my byte request but it doesn't accept -1 value that results from my shifting operations :) Is there any way for me to represent this value as an unsigned byte? Thanks!
Nov 28, 2012 at 19:03 history edited Esailija CC BY-SA 3.0
added 131 characters in body
Nov 28, 2012 at 18:57 history answered Esailija CC BY-SA 3.0